Re: C datatypes VS Oracle datatypes
Date: 1996/02/21
Message-ID: <4ge3pq$jb0_at_news.voicenet.com>#1/1
Try creating your VARCHAR to a size of 6 in your ProC. Then NULL terminate the string yourself after the fetch. ie:
VARCHAR foo[6];
foo.arr[foo.len] = '\0';
Your ProC VARCHAR just needs to be at least as big as the col in the database it does not have to be exactly the same.
Hope this helps...
-Zang
In article <zakrzews.823821161_at_pegasus.montclair.edu>,
zakrzews_at_pegasus.montclair.edu says...
>
>Hi!
>
> I am new to Oracle.
>
>I am programming in C using PRO*C.
>I have problem to handle data retrieved from Oracle.
>Example:
> datatype in Oracle of the field is varchar2[5].
>
>Retrieved data from Oracle are 5 characters long therefore they takes
the
>whole space of the array. If I declare array size of 6 bytes then I can
manipulate array with C library functions, but I can not update or i
>that array. If I declare array of five bytes there is no problem with
Oracle, but
>the string in C is not terminated by NULL.
>
>How this problem is handled. Do I have to maintain two copies of each
string in case I want to
>update the Oracle. (one of the same size and second 1 byte larger for
NULL use in C).
>
>Please share with your experience.
>
>Thanks.
>
>Tom Z.
>
>.
>
>
Received on Wed Feb 21 1996 - 00:00:00 CET
