MySQL Forums
Forum List  »  Oracle

Re: porting data from oracle to mysql
Posted by: Josh Chamas
Date: November 24, 2004 03:36AM

manish singh wrote:
> that would make sense when iam trying to put data
> in
> 12/12/2004 format
>
> but iam not doing so
> the insert statement looks like this
>
> insert into mysql.table1 values( 11111,
> 2004-12-12, 2323);
>
> here the date is in mysql format.
> still it shows 0000-00-00

Same reason as before, that the SQL expression is numeric, and when it goes into a date field, it goes to 0000. You need to quote it so its not a numeric expression.

mysql> create table date_test (dt date);
Query OK, 0 rows affected (0.10 sec)

mysql> insert into date_test values (2004-12-12);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into date_test values(1980);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select * from date_test;
+------------+
| dt |
+------------+
| 0000-00-00 |
| 0000-00-00 |
+------------+
2 rows in set (0.00 sec)

mysql> select 2004-12-12;
+------------+
| 2004-12-12 |
+------------+
| 1980 |
+------------+
1 row in set (0.00 sec)

Regards,

Josh

Josh Chamas
Director, Professional Services
MySQL Inc., www.mysql.com
Get More with MySQL! http://www.mysql.com/consulting

Options: ReplyQuote


Subject
Views
Written By
Posted
16812
October 25, 2004 12:26AM
13171
November 16, 2004 06:54PM
44710
November 16, 2004 09:47PM
14271
November 17, 2004 09:54PM
10439
November 17, 2004 11:36PM
8219
November 21, 2004 10:05PM
13763
November 22, 2004 04:18PM
6599
November 23, 2004 12:29AM
6031
November 23, 2004 01:07PM
5629
November 23, 2004 11:39PM
6031
November 24, 2004 12:06AM
5064
November 24, 2004 02:10AM
Re: porting data from oracle to mysql
6248
November 24, 2004 03:36AM
4421
November 24, 2004 04:43AM
4831
November 24, 2004 03:49PM
4914
November 25, 2004 01:52AM
4991
January 13, 2005 01:42AM
7536
September 05, 2007 10:18AM
8242
January 14, 2008 02:38PM
6687
February 09, 2005 01:22AM
6119
February 10, 2005 05:18PM
6293
March 14, 2007 03:02AM
5858
February 06, 2009 02:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.