Reputation: 131
After exporting oracle table and trying to import the same into MYSQL,i am facing a problem for the date data-type.The date from oracle when imported into MYSQL is displayed as follows example :'04-05-12' is being imported as '0000-00-00'.I tried the date-time data type, but it gives the same result.Using var char solves the problem but this would not be the ideal solution.Experts could you kindly advise
Upvotes: 1
Views: 1994
Reputation: 125865
You're probably best to export the data from Oracle formatted in the manner MySQL expects.
SELECT TO_CHAR(oracle_date, 'YYYY-MM-DD HH24:MI:SS') FROM ...
However, if that isn't possible, you can use MySQL's STR_TO_DATE()
function; for example:
INSERT INTO my_table (mysql_date) VALUES (STR_TO_DATE('04-05-12', '%d-%m-%y'));
Upvotes: 3