Re: Pro*C Assistance
From: Marek Pytlik <pytlik_at_ra.cs.umb.edu>
Date: Sat, 19 Jun 1993 19:12:47 GMT
Message-ID: <1993Jun19.191247.18700_at_cs.umb.edu>
>
>
>My problem is that the date_time variable doesn't get the value in
>date_time and thus prints out a null string. Since I would like to
>do this with database fields from real tables (the example is a test
>program I woute to see if it was possible to do this), this poses a
>problem. Does anyone have suggestions?
>
>I will summarize for the grp. Thanks in Advance!
>
>-Paul
>
>--
>Paul M. Mickel Internet:mickel_at_oes.orst.edu
>Database Programmer, Teledyne Wah Chang Albany, OR 97321
>Disclaimer: My employer never claims my opinions (unless it makes a profit).
Received on Sat Jun 19 1993 - 21:12:47 CEST
Date: Sat, 19 Jun 1993 19:12:47 GMT
Message-ID: <1993Jun19.191247.18700_at_cs.umb.edu>
In article <1vqo7e$8ch_at_gaia.ucs.orst.edu> mickel_at_OES.ORST.EDU (Paul Mickel) writes:
>Greetings,
>
>I have a problem that I thought maybe someone in the grp has dealt with
>before. I am attempting to retrieve date fields from a table using Pro*C
>(Oracle version 6). The code looks like the following:
>
>
>EXEC SQL BEGIN DECLARE SECTION;
> VARCHAR username[20];
> VARCHAR password[20];
> VARCHAR date_time[20];
>EXEC SQL END DECLARE SECTION;
>
>main()
>{
>
> /* Log on to ORACLE here */
> :
> :
>
> EXEC SQL SELECT TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI')
> INTO :date_time
> FROM dual;
>
> fprintf(stdout,"Date_time = %s\n",date_time);
???????????????
date_time.arr[date_time.len] = '\0'; fprintf(stdout,"Date_time = %s\n",(char *)date_time.arr);>}
> :
> /* do some other manipulation */
> :
>
> EXEC SQL COMMIT WORK RELEASE;
>
>
>My problem is that the date_time variable doesn't get the value in
>date_time and thus prints out a null string. Since I would like to
>do this with database fields from real tables (the example is a test
>program I woute to see if it was possible to do this), this poses a
>problem. Does anyone have suggestions?
>
>I will summarize for the grp. Thanks in Advance!
>
>-Paul
>
>--
>Paul M. Mickel Internet:mickel_at_oes.orst.edu
>Database Programmer, Teledyne Wah Chang Albany, OR 97321
>Disclaimer: My employer never claims my opinions (unless it makes a profit).
Received on Sat Jun 19 1993 - 21:12:47 CEST