Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date format in INSERT Sql
In article <1132828866.662365.273610_at_f14g2000cwb.googlegroups.com>,
says...
> Pls help ...
>
> why this sql statement shows error
> ORA-01855: AM/A.M. or PM/P.M. required
>
> INSERT INTO TESTTABLE
> (testid, testdatetime)
> VALUES ( 1, TO_DATE('24-11-2005 06:07 AM', 'DD-MM-YYYY HH:MI AM'));
>
Worked for me:
11:59:50 SQL> create table testtable (testid number, testdatetime date);
Table created.
Elapsed: 00:00:01.05
11:59:55 SQL> INSERT INTO TESTTABLE 12:00:03 2 (testid, testdatetime) 12:00:03 3 VALUES ( 1, TO_DATE('24-11-2005 06:07 AM', 'DD-MM-YYYY HH:MI AM'));
1 row created.
Elapsed: 00:00:00.00
12:00:55 SQL> select * from testtable;
TESTID TESTDATET
---------- ---------
1 24-NOV-05
Elapsed: 00:00:00.02
12:01:00 SQL>
-- jeremy We use Oracle 9iR2 on Solaris 8 with the Oracle HTTP Server and mod_plsqlReceived on Thu Nov 24 2005 - 06:01:27 CST