Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-01861: literal does not match format string

Sangeeta PandeyApr 19 2021

Hello Experts,
I have data in table like below:
Query:select last_update_date from test_table;
Result: 30-MAR-21 09.49.40.523000000 AM
I need data in CSV file in below format:
2018-06-01T10:54:51.952+02:00
There would be more columns in extracted CSV file but format of value for the date should be as mentioned above ('YYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM').
I was trying some thing like below and getting error:
select TO_TIMESTAMP_TZ(last_update_date,'YYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') from test_table;
Error:
ORA-01861: literal does not match format string
01861. 00000 - "literal does not match format string"
*Cause: Literals in the input must be the same length as literals in
the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
*Action: Correct the format string to match the literal.

Kindly help.
Thanks,

This post has been answered by Solomon Yakobson on Apr 19 2021
Jump to Answer
Comments
Post Details
Added on Apr 19 2021
7 comments
16,619 views