我需要创建一个过程,该过程将生成包括查询输出的Excel工作表。 请帮忙!
答案 0 :(得分:0)
查看Rene Nyffenegger解决方案github: https://github.com/ReneNyffenegger/xlsx_writer-Oracle < / a>
据我所知,没有Oracle提供的软件包可以生成xsl / xslx文件
答案 1 :(得分:0)
您可以创建这样的程序包(我们以前是从Tom Kyte衍生而来的):
create or replace package to_excel is
procedure xls(my_query in varchar2);
procedure xls(my_query in varchar2,p_tip in varchar2);
procedure xls2(my_query in varchar2);
procedure csv(my_query in varchar2,p_tip in varchar2);
end;
create or replace package body to_excel is
procedure xls(my_query in varchar2) is
begin
owa_util.mime_header( ccontent_type => 'application/excel');
--, ccharset => 'WE8ISO8859P9' ); -- , ccharset => 'TR8MSWIN1254' , 'UTF-8'
owa_sylk.show( p_query=>replace(my_query,'x*x','%') );
end;
procedure xls(my_query in varchar2,p_tip in varchar2) is
begin
owa_util.mime_header( 'application/excel' );
owa_sylk.show( p_query=>replace(my_query,'x*x','%'), p_tip=>p_tip );
end;
procedure xls2(my_query in varchar2) is
begin
owa_util.mime_header('application/vnd.ms-excel',false);
htp.p('Cache-Control: no-store');
htp.p('Expires: -1');
owa_util.http_header_close;
owa_sylk.show( p_query=>replace(my_query,'x*x','%') );
end;
procedure csv(my_query in varchar2,p_tip in varchar2) is
begin
owa_util.mime_header( 'application/csv' );
owa_sylk.show( p_query=>replace(my_query,'x*x','%'), p_tip=>p_tip );
end;
end;
这是直接从网络浏览器(例如https://..../pls/<dad_name>/<schema_name>.to_excel.xls?my_query=select sysdate from dual