Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: VARCHAR2 in Pro*C
"Schöpflin" <schoepflin_at_ginit.de> wrote:
>There is a real C string data type in Pro/C (type id 5). It's zero
>terminated and everything, you might want to try this one.
>--
>Markus Schoepflin www: http://www.ginit.de
>GINIT Gesellschaft fuer integrierte email: schoepflin_at_ginit.de
>Informationssysteme mbH phone: +49 721 9 66 81 67
>Vincenz-Priessnitz-Str. 1 fax: +49 721 9 66 81 11
>D-76131 Karlsruhe, Germany
Here is more about string: The next three lines define a null-terminated string known to both Oracle and C. I've found this to be very helpful: I never have to worry about the null termination of the string if I use this and I'm not sure, but I don't think the data is padded with blanks.
typedef char CHAR31[31];
EXEC SQL TYPE CHAR31 IS STRING(31);
CHAR31 mystring;
Note, the last character is used for the null. This variable can therefore handle CHAR types of up to 30 characters in length. If you try to select something with more than 30 into mystring, Oracle will give you a 'truncation' error.
George
to select Received on Fri Apr 25 1997 - 00:00:00 CDT
![]() |
![]() |