Re: PRO*C FETCH, is this expected behavior?
Date: 2 Mar 92 03:13:25 GMT
Message-ID: <gsrhpqbtssmith_at_netcom.com>
In article <1992Mar1.162231.9265_at_aio.jsc.nasa.gov> hall_at_orion.jsc.nasa.gov (Philip Hall 283-4031) writes:
> The short answer is "yes". The imbedded SQL behavior is designed
> to be language independent. The termination of a string with a
> NULL character is a C language characteristic. You will either
> have to insert the NULL character using the <variable>.len value
> or always NULL fill your arrays before fetching.
>
> Philip Hall
I missed the original posting that Philip is responding to, but be
aware that in the version 1.4 (available very soon) Pro*C and
Pro*Pascal precompilers, you have a new command EXEC SQL TYPE ...
This allows you to set a defined type to correspond to any ORACLE
external datatype, such as STRING (datatype code 5). So in Pro*C you
could do:
typedef char asciz;
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL TYPE asciz IS STRING(20);
EXEC SQL SELECT ename INTO :emp_name FROM emp WHERE empno = 7499;
and get a null-terminated C string in the emp_name host variable.
There is also an EXEC SQL VAR ... command that let's you do external
/* User-defined type for null-terminated strings */
asciz emp_name[20];
...
EXEC SQL END DECLARE SECTION;
and then do
--Tim (tssmith_at_netcom.com)
(tssmith_at_oracle.com) Received on Mon Mar 02 1992 - 04:13:25 CET