Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Date format in INSERT Sql

Re: Date format in INSERT Sql

From: Jeremy <jeremy0505_at_gmail.com>
Date: Thu, 24 Nov 2005 12:01:27 -0000
Message-ID: <MPG.1defbbf6202d562e98a038@news.individual.net>


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_plsql
Received on Thu Nov 24 2005 - 06:01:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US