Re: Help on a ProC problem.

From: Scott Urman <surman_at_wwsun10.us.oracle.com>
Date: 4 Jan 1995 20:52:14 GMT
Message-ID: <3ef1pu$2gn_at_dcsun4.us.oracle.com>


In article <1995Jan4.023939.24937_at_acd4.acd.com>, jef_at_IEDV6.acd.com ( Jeff Li ) writes:
|> Greetings,
|> I have a question regarding how to get the actual length of a LONG data
|> type column from the SQLDA. I know, according to Oracle 7.0.16, the
|> maximum size of LONG data type is 2 gigabytes. But this size cannot be
|> used to allocate the data buffer. In fact, I could not find a way to get
|> actual data length for varchar2 data type. The SQLDA -> L[i] returns the
|> maximum size of varchar2 when it is declared. My application cannot use
|> a predetermined fix size for LONG datatype. Can anyone help me?
|>
|> Thanks!
|>
|> Jeff Lee
|> Applied Computing Devices, Inc.
|> jef_at_acd4.acd.com

If the long column contains data that is less than 64K in size, you can attempt to fetch it into a buffer that is too small (say 8 bytes). Then you can check the indicator for the actual length (since the data was truncated). But since indicators are 2 bytes, 64K is the limit. The best way is to store the actual length in another column in the same table, and populate this as you insert the row. You can get the length after the fetch of course, but this doesn't really help. I have filed enhancement request 230827 to fix this. The L field will always hold the maximum length. The only way to get the actual length is after the fetch (you can fetch into type 5, for example, and get a null-terminated string). This is great for varchar2 columns, but not wonderful for longs. Received on Wed Jan 04 1995 - 21:52:14 CET

Original text of this message