我正在使用以下博客文章来帮助我导出报告。它很好用,但是我想知道是否可以设置列标题名称?
http://spendolini.blogspot.co.uk/2006/04/custom-export-to-csv.html
我正在使用以下博客文章来帮助我导出报告。它很好用,但是我想知道是否可以设置列标题名称?
http://spendolini.blogspot.co.uk/2006/04/custom-export-to-csv.html
如果您只想提供一个包含列标题的初始行:
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="emp.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
-- Send the initial row with headers
htp.prn('Ename,Empno,Department'||chr(13));
-- Loop through all rows in EMP
for x in (select e.ename, e.empno, d.dname
from emp e, dept d where e.deptno = d.deptno
and e.deptno like :P1_DEPTNO)
loop
-- Print out a portion of a row,
-- separated by commas and ended by a CR
htp.prn(x.ename ||','|| x.empno ||','||
x.dname || chr(13));
end loop;
-- Send an error code so that the
-- rest of the HTML does not render
--htmldb_application.g_unrecoverable_error := true;
--use stop apex_engine
apex_application.stop_apex_engine;
end;
基本上,您只需在发出数据行之前发出额外的一行。
我评论htmldb_application
赞成apex_application.stop_apex_engine
。查看文档