Re: Problem with TO_DATE from PRO*C (gives error 904)

From: L. Scott Johnson <sjohnson_at_math.scarolina.edu>
Date: 4 Jan 1995 16:29:11 GMT
Message-ID: <3eeicn$kpe_at_redwood.cs.scarolina.edu>


jan-olav.eide_at_noner.abb.telemax.no (Jan Olav Eide) writes:

>I seem to be unable to use the TO_DATE function to convert a string
>value for insertion into a date field. Am I missing something
>essential here (Version 6.0.34.2 on a VAX) ?

>EXEC SQL BEGIN DECLARE SECTION
>char datestr[30];
>EXEC SQL END DECLARE SECTION
 
>strcpy(datestr,"17-12-1995 13:12:21");
 

>EXEC SQL UPDATE alarm_status
> SET GMT = TO_DATE(ds,'DD-MM-YYYY HH24:MI:SS')

                                 ^^

> WHERE ALARM_ID = :alarm_id;
^^^^^^^^^

>This gives error code 904 Invalid column name. But GMT and ALARM_ID *are*
>columns of correct types, and I can do the statement in SQL*PLUS without
>problems. I get exactly the same error if I make the column name illegal.

Is DS a column name? or should that line be:
> SET GMT = TO_DATE(:datestr,'DD-MM-YYYY HH24:MI:SS')
?

Where is :alarm_id set/declared?
Try replacing this with a constant value for testing.

L. Scott Johnson
(830) 777-0181 EST Received on Wed Jan 04 1995 - 17:29:11 CET

Original text of this message