您好,登錄后才能下訂單哦!
set SERVEROUT on
DECLARE
tab_sql varchar2(4000);
tab_lob clob;
TYPE ddl_type IS REF CURSOR;
ddl_cur ddl_type;
type tab_ddl_type is record(
ddl_con clob
);
tab_ddl tab_ddl_type;
cursor tab_cur is select DISTINCT object_type,object_name,OWNER from dba_procedures where owner='FWPROD' ;
file utl_file.file_type;
clob_length number(20);
clob_part VARCHAR2(1024);
offset NUMBER := 1;
BEGIN
file := utl_file.fopen('DATA_PUMP_DIR', 'mes_procedure_ddl.log', 'ab');
for i in tab_cur loop
tab_sql := 'select dbms_metadata.get_ddl('''||i.object_type||''','''||i.object_name||''','||''''||i.owner||''') as ddl_con from dual';
DBMS_OUTPUT.PUT_LINE(tab_sql);
open ddl_cur for tab_sql;
FETCH ddl_cur INTO tab_ddl;
--DBMS_OUTPUT.PUT_LINE(tab_ddl.ddl_con);
clob_length := LENGTH(tab_ddl.ddl_con);
offset := 1;
LOOP
EXIT WHEN offset >= clob_length;
clob_part := DBMS_LOB.SUBSTR (tab_ddl.ddl_con, 1024, offset);
UTL_FILE.PUT_RAW(file, utl_raw.cast_to_raw(clob_part));
UTL_FILE.FFLUSH(file);
offset := offset + 1024;
END LOOP;
close ddl_cur;
END LOOP;
utl_file.fclose(file);
END;
/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。