在使用前需要配置apache的连接, 这样在调用过程的时候, 系统直接将生成的html输出到WEB;
--配置apache连接:
如安装在D:\system\https 下, D:\system\https\Apache\modplsql\conf\dads.conf文件. 设置为 :
<Location /ss>
SetHandler pls_handler
Order deny,allow
Allow from all
AllowOverride None
PlsqlDatabaseUsername dinya
PlsqlDatabasePassword dinya
PlsqlDatabaseConnectString dinya:1521:ora10g
PlsqlAuthenticationMode Basic
</Location>
当然对数据库的连接必须有效, 具体请见相关的设置文档. 重起Apache服务.
--创建测试包:
create or replace package cux_html_report as
function t(p_size in number, p_content in varchar2) return varchar2 ;
type c_sql is ref cursor;
procedure main;
procedure html_header(p_title in varchar2);
procedure html_body(p_sql in varchar2,p_column_count in number,p_subtitle in varchar2,p_align in varchar2,p_black in varchar2);
procedure html_tail;
procedure table_h(p_width in number,p_border in number,p_align in varchar2);
procedure table_t;
procedure tr_(p_col_count in number,p_column in varchar2,p_align in varchar2,p_black in varchar2);
procedure tr_h;
procedure tr_t;
procedure td_(p_col_count in number,p_content in varchar2,p_align in varchar2,p_black in varchar2);
procedure report_header(p_title in varchar2);
procedure report_subtitle(p_col_count in number,p_content in varchar2,p_align in varchar2,p_black in varchar2);
procedure report_tail(p_content in varchar2);
end ;
/
create or replace package body cux_html_report as
function t(p_size in number, p_content in varchar2) return varchar2 as
i number:=0;
v_out varchar2(300):='';
p_cont varchar2(1000):=p_content;
begin
for ii in 1..p_size loop
select substr(p_cont,0,decode(instr(p_cont,';'),0,length(p_cont),instr(p_cont,';')-1))
into v_out from dual ;
p_cont:=substr(p_cont,instr(p_cont,';')+1);
i:=i+1;
if i=p_size then
return v_out;
end if;
end loop;
end ;
/*******************************************************************************
主程序
需要处理分页的问题