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: TO_DATE transformation

Re: TO_DATE transformation

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 25 Mar 2002 21:12:26 -0600
Message-ID: <ur8m7ua5b.fsf@rcn.com>


On Mon, 25 Mar 2002, rkg100_at_erols.com wrote:
> This is for SQLLDR but Im testing it with an insert...
>
> I have date data that is in a text file that comes in looking like the
> following 04/04/2001 which is I remember correctly(Im at home and dont
> have what I wrote at work with me) is in the form DD/MM/YYYY
>
> Im trying to insert this kind of record and I get errors. Here is what
> I did...
>
> Insert into Table(Date_Column)
> Values(TO_DATE('04/04/2001', DD/MM/YYYY);
>
> That does not work. I get errors. Cant remember what it was exactly...
> something about bad date format. I tried doing a to_char then a
> to_date and got errors with that too.
>
> What do I do?

Do any of the following errors show up?

    SQL> Insert into t1(fld1)
     Values(TO_DATE('04/04/2001', DD/MM/YYYY);

     Values(TO_DATE('04/04/2001', DD/MM/YYYY)
                                            *
    ERROR at line 2:
    ORA-00917: missing comma

    SQL> SQL> Insert into t1(fld1)

     Values(TO_DATE('04/04/2001', 'DD/MM/YYYY');
     Values(TO_DATE('04/04/2001', 'DD/MM/YYYY')
                                              *
    ERROR at line 2:
    ORA-00917: missing comma

    SQL> Insert into t1(fld1)

     Values(TO_DATE('04/04/2001', DD/MM/YYYY));
     Values(TO_DATE('04/04/2001', DD/MM/YYYY))
                                        *
    ERROR at line 2:
    ORA-00984: column not allowed here

NOW, TRY THIS:     SQL> Insert into t1(fld1)
     Values(TO_DATE('04/04/2001', 'DD/MM/YYYY'));

    1 row created.

-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
Received on Mon Mar 25 2002 - 21:12:26 CST

Original text of this message

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