Getting the actual length for column [message #269154] |
Thu, 20 September 2007 21:08 |
ychan
Messages: 1 Registered: September 2007
|
Junior Member |
|
|
Is there a way to get the actual length (i.e. number of characters, bytes ... )of a column?
I'm using low level OCI calls, and my problem is that OCIAttrGet() returns the max size for the length. This doesn't sound bad, but I need to allocate a buffer just big enough to hold the returned data. More specifically, if I'm using the NCHAR datatype and the result set contains the data "hello" the size will always equal to max column size. Does anyone know of a low level OCI call which would return 5?
|
|
|
Re: Getting the actual length for column [message #269195 is a reply to message #269154] |
Fri, 21 September 2007 02:05 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
But you can't know the actual of the data before you fetch it.
And if you fetch it then you must have a buffer to get the data.
And so you must first allocate the buffer.
Which size? At least the max size you may encounter.
Of course, you can allocate less space but then you could suffer truncation.
Regards
Michel
|
|
|