Switch
Switch

Reputation: 15463

SQL Server to Oracle | Date format error

I'm trying to import data from a SQL Server database to Oracle. But I'm having a problem in date conversion, this is the SQL Server date (time stamp) that appears in .cvs file.

2008-01-09 15:52:21.483

I'm trying to figure out the correct date format:

select TO_DATE('2008-01-09 15:52:21.483','YYYY-MM-DD HH24:MI:SS.FF9') from dual  

But this is giving me an error:

Error starting at line 1 in command:
select TO_DATE('2008-01-09 15:52:21.483','YYYY-MM-DD HH:MI:SS.FF9') from dual
Error report:
SQL Error: ORA-01821: date format not recognized
01821. 00000 -  "date format not recognized"
*Cause:    
*Action:

Can someone explain be the correct date format for this time stamp.

Upvotes: 2

Views: 1922

Answers (1)

zerkms
zerkms

Reputation: 255105

Oracle date type doesn't support fractions of second. If you need them - you need to create timestamp instead:

select TO_TIMESTAMP('2008-01-09 15:52:21.483','YYYY-MM-DD HH24:MI:SS.FF9')
  from dual

Upvotes: 1

Related Questions