Home » Developer & Programmer » Precompilers, OCI & OCCI » Getting the actual length for column
Getting the actual length for column [message #269154] Thu, 20 September 2007 21:08 Go to next message
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 Go to previous message
Michel Cadot
Messages: 68421
Registered: March 2007
Location: Nanterre, France, http://...
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.

Previous Topic: To obtain s800 shared executable
Next Topic: occi: No such file or directory -- error: `oracle' has not been declared
Goto Forum:

Current Time: Fri Mar 31 11:50:01 CDT 2023