Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> HELP! RETURN CLOB from External DLL
Hi
I am working on an External DLL using OCI. Basically, PL/SQL calls an External DLL to process the data and then returns LOB back to the PL/SQL procedure. Inside the DLL, I created a Temporary lob to process the data. The error is prompted from PL/SQL:
SQL> exec isdb.test_clob;
Before original length=10 ORA-24805: LOB type mismatch ORA-06512: at "ISDBSVR.ISDB", line 24 ORA-06512: at "ISDBSVR.ISDB", line 29 ORA-06512: at line 1
So far I know that error is caused by the return from PLS_CLOB is not clob. "After_original := PLS_CLOB(before_original); {you will see more code in the below}" However inside the DLL, I have defined OCIClobLocator and OCI_TEMP_CLOB to carry the CLOB data.
I have found the following observations: 1. If I change everything to blob, it works fine. (such as OCILobLocator, OCI_TEMP_CLOB and all variables in PL/SQL) 2. If I run the same DLL and PL/SQL in 9i, it works fine (clob too)
I guess it would be a bug for clob, please help to check thanks
PROCEDURE TEST_CLOB IS
before_original cLOB;
After_original cLOB;
CHAR_TO_CLOB varchar(200);
bsize int;
BEGIN
CHAR_TO_CLOB := 'AAAAAAABBBBBBCCCCCCC';
dbms_lob.createtemporary( before_original, TRUE );
DBMS_LOB.write( before_original,10,1,CHAR_TO_CLOB);
bSize := DBMS_LOB.GetLength(before_original);
DBMS_OUTPUT.PUT_LINE('Before original length='||bSize);
After_original := PLS_CLOB(before_original);
bSize := DBMS_LOB.GetLength(After_original);
DBMS_OUTPUT.PUT_LINE('After original length='||bSize);
dbms_lob.freetemporary(before_original);
END;
END ISDB;
/* CODE - DLL */
_EXPORT OCILobLocator * Encrypt_Blob(OCIExtProcContext *with_context,
OCILobLocator *plaintext2, sb4 pt_indicator2, sb4 *ret_indicator )
ocictx oci_ctx; ocictx *oci_ctxp = &oci_ctx; status = OCIExtProcGetEnv(with_context, &oci_ctxp->envhp, &oci_ctxp->svchp, &oci_ctxp->errhp); status = OCIDescriptorAlloc(oci_ctxp->envhp, (dvoid **) &cipherbb, (ub4) OCI_DTYPE_LOB, (size_t) 0, (dvoid **) 0); status = (int) OCILobCreateTemporary(oci_ctxp->svchp, oci_ctxp->errhp, cipherbb, OCI_DEFAULT, OCI_DEFAULT, OCI_TEMP_CLOB, OCI_ATTR_NOCACHE, OCI_DURATION_SESSION);amount = 6;
oci_ctxp->errhp, cipherbb, plaintext2, amount, (ub4) 1, (ub4) 1);
OCIDescriptorFree((dvoid *) cipherbb, (ub4) OCI_DTYPE_LOB); return(cipherbb); Received on Fri Dec 28 2001 - 00:57:57 CST
![]() |
![]() |