create or replace
PROCEDURE
output_biaoqian2(v_dir varchar2,v_name varchar2) AS
cursor cursor_terminal is
select distinct deptno from emp order by 1;
v_filehandle utl_file.file_type;
begin
for t_cursor_terminal in cursor_terminal loop
v_filehandle :=
utl_file.fopen(v_dir,v_name||'_'||t_cursor_terminal. deptno ||'.txt','w');
for i in (select * from emp where deptno =t_cursor_terminal. deptno ) loop
utl_file.putf(v_filehandle,'%s\n',i.ename);
end loop;
utl_file.fclose(v_filehandle);
end loop;
--end loop;
end output_biaoqian2;上面的过程,可将EMP表的ENAME,按部门分类输出至TXT文件,现在希望对这段程序进行改进,将里面的 DEPTNO 和 EMP用输入变量代替,有好的解决方法吗
因初学,能提供完整代码,将感激不尽。
PROCEDURE
output_biaoqian2(v_dir varchar2,v_name varchar2) AS
cursor cursor_terminal is
select distinct deptno from emp order by 1;
v_filehandle utl_file.file_type;
begin
for t_cursor_terminal in cursor_terminal loop
v_filehandle :=
utl_file.fopen(v_dir,v_name||'_'||t_cursor_terminal. deptno ||'.txt','w');
for i in (select * from emp where deptno =t_cursor_terminal. deptno ) loop
utl_file.putf(v_filehandle,'%s\n',i.ename);
end loop;
utl_file.fclose(v_filehandle);
end loop;
--end loop;
end output_biaoqian2;上面的过程,可将EMP表的ENAME,按部门分类输出至TXT文件,现在希望对这段程序进行改进,将里面的 DEPTNO 和 EMP用输入变量代替,有好的解决方法吗
因初学,能提供完整代码,将感激不尽。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货