Re: Inserting values into DATE datatype using OCI
Date: 1996/11/13
Message-ID: <328A0F00.3D5A_at_mitre.org>#1/1
Puru Balakrishnan wrote:
>
> Hello,
>
> I am having problems while inserting data into date datatype using OCI.
> The sequence of steps are:
>
> a) SQL Statement:
> insert into datetime_table( intfld, datefld) values (?,?)
>
> b) parse the SQL Statement by using oparse()
>
> c) Bind placeholders using obndrv() function
> The values supplied to the program variable are:
> For integer field - 999
> For date field - TO_DATE('11-12-1996', ,'MM-DD-YYYY')
> The datatypes for both of the above variables is set to VARCHAR2
>
> d) Execute the SQL Statement using oexec() function
>
> After (d), Oracle displays an error message "ORA-1858, a non-numeric
> character found where a digit was expected".
>
> I would like to know if this is the correct way to insert values into a
> date
> datatype or is there a better way to do this.
>
> Thanks for any help/suggestions.
>
> Puru Balakrishnan
> Symantec Corporation
Its been a while since I've used OCI, but for your situation, I think
you have to put the TO_DATE() within the SQL statement, and '11-12-1996'
within your C string variable. The ? reference can only refer to a
string or numeric value.
-Peter
Received on Wed Nov 13 1996 - 00:00:00 CET