Home » Developer & Programmer » Precompilers, OCI & OCCI » OCI: retrieving string-like data from output parameters effectively (Do oracle stuff really think that copying a string of N characters requires O(N*logN) operations? 8-) Or am I missing something..?)
icon5.gif  OCI: retrieving string-like data from output parameters effectively [message #274193] Mon, 15 October 2007 00:58
_mas
Messages: 1
Registered: October 2007
Location: Russia
Junior Member
Hi, all.

I am solving the following very simple task.
Using OCI calls, I need to call some procedure with two VARCHAR2 parameters, the first is IN and the second is OUT.
There are no problems with the first param Smile
But there are some client-side problems with the second one..
Firstly I do not know for sure the maximal possible length of the output string. Secondly I need to copy the whole string into exactly ONE linear buffer, separating it into linked list of pieces is not an option.
I have tried the following:
1) Calling OCIBindByName for the OUT-param with OCI_DEFAULT.
Result. If the length of my buffer is smaller than the actual output string I am getting ORA-06502 and, it seems, without any information about the actual length of the string (but even if I would get it, there is quite no reason to make the second execute, cause I can not know exactly what the procedure is doing there)
2) Calling OCIBindByName for the OUT-param with OCI_DATA_AT_EXEC.
Result. If the length of my buffer is smaller than the actual output string I can increase the buffer size in the following invocations of the callback. BUT! I still can not get the actual length of the string from OCI 8-( (In spite of the fact that it is said in docs that indicator variables are to be used to return the actual data length if it does not fit, there values are unchanged before every callback.) So the only reasonable strategy I see is to multiply the buffer size by some factor (2 for instance) each time the callback is issued. But this requires O(N*logN) operations for fetching N characters into the linear buffer... Sad

Are there some better ways to do this simple thing ?
Previous Topic: PCC-S-02322, found undefined identifier compiling under Fedora 6
Next Topic: [RESOLVED] Pro*C compilation error / Object type / AQ
Goto Forum:
  


Current Time: Sun Apr 20 03:31:31 CDT 2014

Total time taken to generate the page: 0.07243 seconds