MySQL Forums
Forum List  »  Oracle

importing using LOAD DATA INFILE
Posted by: Sridhar Ramalingam
Date: August 05, 2009 02:05AM


I am in middle of transferring data from Oracle tables to MySQL (5.1.37). I have a flat file with 3 columns in it...

"XXXX",3/18/1998,3/3/2004 3:28:59 PM
"YYYY",3/23/1998,3/3/2004 3:29:01 PM
"ZZZZ",5/18/1998,3/3/2004 3:30:45 PM
"AAAA",5/19/1998,3/3/2004 3:30:47 PM

The destination table in MySQL looks like this...

| Field | Type |
| SOMEXX_ID | varchar(20) |
| SUBMIT_DATE | date |
| CREATION_DATE | timestamp |

And, here's the load command i used...

LOAD DATA INFILE '/data-dump/TEST.txt'
FIELDS TERMINATED BY ',' optionally enclosed by '"' lines terminated by '\n'
(SOMEXX_ID, @var1, @var2)
SET SUBMIT_DATE = date_format(str_to_date(@var1, '%m/%d/%Y'), '%Y-%m-%d'),
CREATION_DATE = date_format(str_to_date(@var2, '%m/%d/%Y %l:%i:%s %p'), '%Y-%m-%d %l:%i:%s %p');

All the rows were imported successfully into MySQL table, the data checkout ok, but it had a bunch of warning....

+---------+------+-----------------------------------------------------+| Level | Code | Message |+---------+------+-----------------------------------------------------+
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 1 |
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 2 |
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 3 |

I am not able to figure out why there are warnings even though the data was imported successfully and the data looked accurate.

Can someone please advise?


Options: ReplyQuote

Written By
importing using LOAD DATA INFILE
August 05, 2009 02:05AM
September 19, 2009 08:50AM

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.