I havent done PLSQL for a long time and try to run a script to assist in querying a XML blob.
The script is from an old thread, (https://community.oracle.com/thread/514518) aparently worked at that time but it seems to have problems running on 11.2.
My dbs: Oracle Database 11g Release 11.2.0.4.0 - 64bit Production PL/SQL Release 11.2.0.4.0 - Production "CORE 11.2.0.4.0 Production" TNS for Linux: Version 11.2.0.4.0 - Production NLSRTL Version 11.2.0.4.0 - Production
CREATE OR REPLACE FUNCTION XBLOB_To_CLOB(L_BLOB BLOB) RETURN CLOB IS
L_CLOB CLOB;
L_SRC_OFFSET NUMBER;
L_DEST_OFFSET NUMBER;
L_BLOB_CSID NUMBER := DBMS_LOB.DEFAULT_CSID;
V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
L_WARNING NUMBER;
L_AMOUNT NUMBER;
BEGIN
IF DBMS_LOB.GETLENGTH(L_BLOB) > 0 THEN
DBMS_LOB.CREATETEMPORARY(L_CLOB, TRUE);
L_SRC_OFFSET := 1;
L_DEST_OFFSET := 1;
L_AMOUNT := DBMS_LOB.GETLENGTH(L_BLOB);
DBMS_LOB.CONVERTTOCLOB(L_CLOB,
L_BLOB,
L_AMOUNT,
L_SRC_OFFSET,
L_DEST_OFFSET,
1,
V_LANG_CONTEXT,
L_WARNING);
RETURN L_CLOB;
ELSE
L_CLOB:= TO_CLOB('');
RETURN L_CLOB;
End IF;
DBMS_LOB.FREETEMPORARY(L_CLOB);
END;
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275 ORA-06512: in "SYS.DBMS_LOB", row 978 ORA-06512: in "TEST.XBLOB_To_CLOB", row 14
Currently, the script is not executed by another script or remot function, i just tried to run it in the SQL Developer. I know that there are a lot of questions concerning ORA-22275, but i found nothing that looks like my problem. The other scripts on the thread that apparently were running well, returns the same ORA-22275 error.
Any suggestions whats wrong with the code or the dbs ?
TEST.BLOB2CLOB
and notTEST.XBLOB_TO_CLOB
- gvenzl