重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

oracleplsqlutl_file

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;
/

我们提供的服务有:成都网站设计、成都网站建设、微信公众号开发、网站优化、网站认证、黔西南州ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的黔西南州网站制作公司


当前题目:oracleplsqlutl_file
标题网址:http://cqcxhl.com/article/pisigo.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP