Re: OCI Insert - Date Field Problem

From: Michael Krolewski <vandra_at_u.washington.edu>
Date: Sun, 24 May 1998 00:22:05 -0700
Message-ID: <3567CA9D.E7553240_at_u.washington.edu>


Change the sql statement....

    insert into tableX ( ... fieldI, ... )     values

            ...., to_date( :yourVariable, 'MM/DD/YYYY HH24:MI:SS' ), ....

The :yourVariable would be a string variable not a date variable.

Mike Krolewski

Stan Newby wrote:

> Hi:
>
> I'm writing a C program using OCI to update data in Oracle 7.3.
> I'm attempting to insert a row with a date field. I am using
> obndrn to bind a null terminated string containing the date
> before the oexec. The problem is that the date I'm trying to
> insert is in the format ' 'MM/DD/YYYY HH24:MI:SS' and our instance
> default is something like DD-MON-YY, so I get a "ORA-1483 error -
> not a valid month". If I change the date I'm inserting to the
> DD-MON-YY default format the insert works, but is not what I want
> because I loose the time components. I can't get our DBAs to change
> the default format neither.
>
> Is there some way I can use the TO_DATE function to get around this
> problem?
> If so, how would I use it? During the bind? (i.e. If :3 was the date
> field
> then ..."insert into table values (:1, :2, TO_DATE(:3,'DateMask')) ").
>
> Any suggestions are appreciated.
>
> Stan Newby
> EDS-TESCA
> siclaro _at_ dfw _dot_ net
Received on Sun May 24 1998 - 09:22:05 CEST

Original text of this message