1

I need to insert the following date/time format to Oracle:

INSERT INTO mytable (ID, DATETIMEREAD) VALUES (1, TO_TIMESTAMP('2016-06-03T11:28:07.571', 'YYYY-MM-DDTHH24:MM:SS')

I´m getting the following error:

ORA-01821: date format not recognized

How can I properly insert that ISO format (without time zone) to Oracle. The DATETIMEREAD column type is TIMESTAMP(6)

Mendes
  • 17,489
  • 35
  • 150
  • 263
  • [Possible duplicate](http://stackoverflow.com/q/24638426/266304)? Except it doesn't show the FF3 part of the format model... – Alex Poole Jun 03 '16 at 16:20

1 Answers1

8

T is not any Oracle timestamp element. You need to enclose it in double quotes. Also minutes are MI and you miss the fraction of second mask too. This should do the job:

INSERT INTO mytable (ID, DATETIMEREAD) VALUES (1, TO_TIMESTAMP('2016-06-03T11:28:07.571', 'YYYY-MM-DD"T"HH24:MI:SS.FF3'))
Husqvik
  • 5,669
  • 1
  • 19
  • 29