Re: Pro*C Assistance

From: Ken Salter x3746 <kgs1_at_ecdcsvr.tredydev.unisys.com>
Date: Fri, 18 Jun 1993 12:50:31 GMT
Message-ID: <1993Jun18.125031.14533_at_ecdcsvr.tredydev.unisys.com>


In article <1vqo7e$8ch_at_gaia.ucs.orst.edu> mickel_at_OES.ORST.EDU (Paul Mickel) writes:
>EXEC SQL BEGIN DECLARE SECTION;
> VARCHAR username[20];
> VARCHAR password[20];
> VARCHAR date_time[20];
>EXEC SQL END DECLARE SECTION;
>
> EXEC SQL SELECT TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI')
> INTO :date_time
> FROM dual;
>
> fprintf(stdout,"Date_time = %s\n",date_time);
> :
> /* do some other manipulation */
>
>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?

        VARCHAR date_time[20];

expands to:

	struct { short int;
		 char  arr[20];
	       } date_time;

You must:

  1. date_time.arr[date_time.len+1] = '\n';
  2. fprint ( ... date_time.arr);

I tried private mail, but it bounced.

Ken Salter Received on Fri Jun 18 1993 - 14:50:31 CEST

Original text of this message