********************************************************************************/
procedure main as
begin
html_header('我的测试报表');
report_header('我的标题');
html_body('select t.owner||'';''||t.object_name||'';''||t.object_id||'';''||t.object_type||'';''||t.owner
from all_objects t
where t.owner=''DINYA''
and rownum<=100',5,'序号;对象名称;ID;类型','center','<b></b>');
report_tail('这里是报表尾');
html_tail;
end;
--页头,固定格式
procedure html_header(p_title in varchar2) as
begin
htp.p('
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>'||nvl(trim(p_title),'无标题文档')||'</title>
</head>
<body>');
end ;
--页体, 根据SQL程序和字段数,展示数据
procedure html_body(p_sql in varchar2,p_column_count in number,p_subtitle in varchar2,p_align in varchar2,p_black in varchar2) as
i number:=0;
c c_sql;
v_column varchar2(4000);
begin
table_h(90,1,'center');
report_subtitle(p_column_count,p_subtitle,p_align,p_black);
open c for p_sql;
loop
fetch c into v_column;
exit when c%notfound;
i:=i+1;
tr_(p_column_count,v_column,'left','');
end loop;
table_t;
end ;
--页尾, 固定内容
procedure html_tail as
begin
htp.p('</body> </html>');
end ;
--------------------------------------------------------------------------------
--表头, 表的属性
procedure table_h(p_width in number,p_border in number,p_align in varchar2) as
begin
htp.p('<table width="'||p_width||'%" border="'||p_border||'" align="'||p_align||'">');
end ;
--表尾
procedure table_t as
begin
htp.p('</table>');
end ;
--------------------------------------------------------------------------------
--表格行
--------------------------------------------------------------------------------
procedure tr_(p_col_count in number,p_column in varchar2,p_align in varchar2,p_black in varchar2) as
begin
htp.p('<tr>');
td_(p_col_count,p_column,p_align,p_black);
htp.p('</tr>');
end;
procedure tr_h as
begin
htp.p('<tr>');
end ;
procedure tr_t as
begin
htp.p('</tr>');
end ;
-------------------------------------------------------------------------------
--表单元格
文章来源于领测软件测试网 https://www.ltesting.net/