ORA-06512: at "SYS.DBMS_LOB", line 715 - How to fix this bug?
521994Jul 6 2006 — edited Jul 7 2006I use below script to extract DDL and write it to a flat file, but
ORA-06512: at "SYS.DBMS_LOB", line 715(previous error is ORA-21560) always occured when the DDL length exceed 32767.
if i change DBMS_LOB.read to DBMS_LOB.substr, no error occured, but string exceed 32767 will be cut.
Is it a DB bug, how can i fix it? or use alternative method to read varchar2 from CLOB variable?
DB release is Oracle 9i Enterprise Edition Release 9.2.0.5.0
--------- Script --------
SELECT dbms_metadata.get_ddl(t_obj_type,t_obj_name,t_owner)
INTO t_ddl
FROM dual;
amount := 32767;
offset := 1;
clob_len := DBMS_LOB.getlength(t_ddl);
WHILE offset < clob_len LOOP
DBMS_LOB.read(lob_loc => t_ddl,amount => amount,offset => offset,buffer => buffer);
offset := amount + offset;
UTL_FILE.PUT(file => file_handle,buffer => buffer);
UTL_FILE.FFLUSH(file => file_handle);
END LOOP;
--------------------------
Thanks.