Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date Insert Problem
camou wrote:
> I am string to insert dates in this format :2005-08-19
>
> I tried to do : insert into foo (foodate) values('2005-08-19');
>
> foo date is an Oracle date type field.
>
> I get [ORA-01861: literal does not match format string]\
Hmmm, I wonder why ... oh, yes, in most cases the nls_date_format is set to 'DD-MON-RR' ... and, gee, that doesn't match what you've tried to submit as a date ...
>
> I can only get a text filed with dates in this format. How can i insert
> this.
>
Reading the documentation (something you should try) reveals the following function to convert date strings into actual dates:
insert into foo (foodate) values(to_date('2005-08-19', 'YYYY-MM-DD'));
> Thanks!
David Fitzjarrell Received on Mon Feb 06 2006 - 16:52:54 CST