Bluehost.com Web Hosting $6.95

oracle to_date vs mysql date_format

This is a discussion on oracle to_date vs mysql date_format within the MySQL Database forums, part of the Database Forums category; Hello, Try to migrate a subset of data from Oracle 9i to mysql 5.0. The mysql migration toolkit does ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-17-2007
ton de w
 
Posts: n/a
Default oracle to_date vs mysql date_format

Hello,
Try to migrate a subset of data from Oracle 9i to mysql 5.0. The mysql
migration toolkit does not seem to allow me to snarf a subset of a
table.
So I am doing an export from Oracle 91 which creates sql insert
statements.
These insert statements contain to_date('16-MAY-07','DD-MON-RR'), for
example. So I plan to do a search and replace in the sql file using
date_format instead of to_date.
but I have only succeeded in getting NULL as a result of passing in
date_format( '16-MAY-07', %d %M %y). the format string is always 'DD-
MON-RR' could someone advise on the correct date_format incantation
is? It is suppsoed to be all working tomorrow and I have to leave now
after an 11 hour day!

TIA

Ton

Reply With Quote
  #2 (permalink)  
Old 05-17-2007
Paul Lautman
 
Posts: n/a
Default Re: oracle to_date vs mysql date_format

ton de w wrote:
> Hello,
> Try to migrate a subset of data from Oracle 9i to mysql 5.0. The mysql
> migration toolkit does not seem to allow me to snarf a subset of a
> table.
> So I am doing an export from Oracle 91 which creates sql insert
> statements.
> These insert statements contain to_date('16-MAY-07','DD-MON-RR'), for
> example. So I plan to do a search and replace in the sql file using
> date_format instead of to_date.
> but I have only succeeded in getting NULL as a result of passing in
> date_format( '16-MAY-07', %d %M %y). the format string is always 'DD-
> MON-RR' could someone advise on the correct date_format incantation
> is? It is suppsoed to be all working tomorrow and I have to leave now
> after an 11 hour day!
>
> TIA
>
> Ton


Two problems here.
1) You need to put the format string in quotes as it shows you in the
manual.
2) The manual explains that DATE_FORMAT takes an ISO date and returns it in
the format that you specify in the format string. It does not take a date in
some other format and return an ISO date. For that you need the function
STR_TO_DATE


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0