Skip to Main Content

Oracle Database Discussions

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!

to_char(to_date('31/12/2013', 'dd/mm/yyyy'), 'yyyymmdd') why it doesn't wor

516988Mar 17 2008 — edited Mar 17 2008
I have the following table (this is a sample so I don't have to send you my entire (code):

create table x (a date);

When I try to insert the following date with format 'yyyymmdd') I am getting the following error message:
ORA-01861 literal does not match format string

insert into x
SELECT DISTINCT
to_char(to_date('31/12/2013', 'dd/mm/yyyy'), 'yyyymmdd')
from dual

Can someone tell me what I am doing wrong? Please do not tell me to change the column to char because I know this will work but it has to stay as date datatype...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2008
Added on Mar 17 2008
4 comments
2,641 views