Problem with binding array of clobs
866210Sep 14 2011 — edited Sep 19 2011Hi All,
I’m using DBMS Oracle 11.2.0.1 64 bit version installed on Windows 7 and found strange issue when I used clob arrays via OCI. Could anybody help me with some advices?
I have package with simple stored procedure
PROCEDURE put_clob_test(sMsg CLOB);
This procedure was developed for test purposes and only insert clob data to the simple table.
I’m trying put array of data using C++ and OCI.
I’m trying use SQL Statement described below:
BEGIN FOR i IN 1 .. :1 .COUNT LOOP mypackage.put_clob_test(:1(i)); END LOOP; END;
But when I bind array of OCILobLocators (previously initialized) and execute statement I, get error
ORA-03113: end-of-file on communication channel.
Alert log notifies error:
ORA-07445: exception encountered: core dump [pfritg()+368] [ACCESS_VIOLATION] [ADDR:0x1000000005] [PC:0xB1768DC] [UNABLE_TO_READ]
If I do the same, but bind array of strings (SQLT_STR) all works perfect. Also I’m sure that OCILobLocators initialized correctly. I can use them without arrays (using statement "BEGIN mypackage.put_clob_test(:1); END;" and passing curelep = 0 to OCIBindByName function)
Did anybody use similar way to pass the arrays of clobs? Did anybody notice similar problems? Can anybody give me any advices about possible workarounds?
There is a code that binds array of OCILobLocators:
nOracleError = OCIBindByName(hOciStmt,
(OCIBind **) &hOCIBindHandle,
hOciError,
TO_ORA_TEXT(_bstr_t(":1")),
ORA_TEXT LEN(bstr_t(":1")),
locators, //valuep (IN/OUT)
sizeof(locators[0]), //value_sz(IN)
SQLT_CLOB, //dty (IN)- The data type of the value(s) being bound.
indicators, //indp (IN/OUT) - Pointer to an indicator variable or array.
aLen, //alenp (IN/OUT) - Pointer to array of actual lengths of array elements.
rCode, //rcodep (OUT) - Pointer to array of column level return codes. This parameter is ignored for dynamic binds.
eIterations, //maxarr_len (IN) - The maximum possible number of elements of type dty in a PL/SQL binds.
&curElNum, //A pointer to the actual number of elements. This parameter is only required for PL/SQL binds.
0);
There is a code that binds string data (that works as expected):
static wchar_t * strings[] = {L"Hello1", L"Hello2"};
enum { eIterations = sizeof(strings)/sizeof(strings[0]) };
static ub2 aLen[eIterations] = {wcslen(strings[0]) * sizeof(wchar_t), wcslen(strings[1])* sizeof(wchar_t)};
static ub2 indicators[eIterations] = {0};
static ub2 rCode[eIterations] = {0};
static ub4 curElNum = eIterations;
nOracleError = OCIBindByName(hOciStmt,
(OCIBind **) &hOCIBindHandle,
hOciError,
ToOraText(_bstr_t(":1")),
ToOraTextLen(_bstr_t(":1")),
strings, //valuep (IN/OUT)
200, //value_sz(IN)
SQLT_STR, //dty (IN)- The data type of the value(s) being bound.
indicators, //indp (IN/OUT) - Pointer to an indicator variable or array.
aLen, //alenp (IN/OUT) - Pointer to array of actual lengths of array elements.
rCode, //rcodep (OUT) - Pointer to array of column level return codes. This parameter is ignored for dynamic binds.
eIterations, //maxarr_len (IN) - The maximum possible number of elements of type dty in a PL/SQL binds.
&curElNum, //curelep (IN/OUT)
0);
Do you have any ideas?
Thanks in advance.