Search code examples
sqloracle-databaseinsertto-dateora-00900

ORA-00900: invalid SQL statement on to_date in oracle


I get an error in a INSERT. The problem is in this line:

to_date('05-JUN-13 01.09.10.000000 PM','DD-MON-YY HH.MI.SS.FF') 

I don't know how resolve it. I tried also with

to_timestamp('05-JUN-13 01.09.10.000000 PM','DD-MON-YY HH.MI.SS.FF')

But i had this error:

ORA-01830: date format picture ends before converting entire input string

Any helps? Thanks a lot


Solution

  • The AM/PM format is missing, therefore the "date format picture" (what a wonderful name!) ends too early. Just use

    to_timestamp('05-JUN-13 01.09.10.000000 PM', 'DD-MON-YY HH.MI.SS.FF6 AM')