开发者

SQL Server to Oracle | Date format error

开发者 https://www.devze.com 2023-02-17 08:04 出处:网络
I\'m trying to开发者_如何学JAVA 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.

I'm trying to开发者_如何学JAVA 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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号