Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Null terminating strings selected into host variables
A varchar2 is in fact a structure, the first element is the length of the
selected value. You could use this length as an index to put a '\0' in the
data part, after which you could use that part as a null-terminated string.
This only works if you effectively selected a value, and not null!
holman_at_fas.harvard.edu heeft geschreven in bericht
<7elarv$per$1_at_nnrp1.dejanews.com>...
>Hello,
>
>I'm new to Oracle embedded SQL, though have used SQL in other products.
>
>I'm programming in C, and selecting into host variables, and finding that
>varchar2 data types are neither null terminated nor trim blanked. When I
>select directly into char arrays (not host variables), the strings are null
>terminated.
>
>Should I expect that selecting into a host variable (a struct of several
>variable length char arrays and several int values) would null terminate a
>varchar2 string by default? Do I need to change all my varchar2 type
columns
>to string type columns? Has anyone been here, done that?
>
>TIA,
>
>Candace Holman
>Network Software Engineer
>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Fri Apr 09 1999 - 13:03:08 CDT
![]() |
![]() |