'Oracle OCI error when executing stored procedure with output parameter
I am trying to execute a simple stored procedure using Oracle OCI. The stored procedure takes a string as an input and copies it to the output parameter. Below is the oracle statement that I am executing:
DECLARE OutParam VARCHAR2(50);
BEGIN
my_stored_procedure('Test String', OutParam);
END;
And I wrote the OCI code as follows:
/* Bind a placeholder for the output parameter */
if (status = OCIBindByPos(stmthp, &bnd6p, errhp, 1,
(dvoid *)result, 1024, SQLT_STR,
(dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0, OCI_DEFAULT))
{
checkerr(errhp, status);
cleanup();
return OCI_ERROR;
}
/* execute and fetch */
if (status = OCIStmtExecute(svchp, stmthp, errhp, (ub4)1, (ub4)0,
(CONST OCISnapshot *) NULL, (OCISnapshot *)NULL, OCI_DEFAULT))
{
if (status != OCI_NO_DATA)
{
checkerr(errhp, status);
cleanup();
return OCI_ERROR;
}
}
With Oracle 11g and older versions, this worked fine and I was able to get the output parameter stored in the 'result' variable I used in the OCIBindByPos call.
However, with Oracle 12 and above this does not work for me, I am getting the following error:
OCI_ERROR - ORA-03137: malformed TTC packet from client rejected: [kpoal8Check-5] [32768]
Does anyone know why this does not work with Oracle versions 12 and above? I tested this with Oracle 12 and Oracle 19 and got the same error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|