ITPub博客

首页 > Linux操作系统 > Linux操作系统 > HOW TO Create HTML Output from SQL*Plus

HOW TO Create HTML Output from SQL*Plus

原创 Linux操作系统 作者:vongates 时间:2019-01-20 21:51:04 0 删除 编辑

在日常的生產中,可能同一支report對很多人都是需要的,如果同時有很多人查詢同樣的報表會對系統性能有一定的影響,這樣我們可以用sql*plus來定時生成靜態的html實現相關的需求 可以參考相關網頁  


In Oracle there is a super-easy way to make your output display in HTML format.

This is a great tool for web-based ad-hoc query tools and you can collect input from the end-users, spool a query to SQL*Plus and then return the data as an HTML page.

For example, let's assume that your Web Form does an employee report of employee name and salary and you want to return the output as an HTML file, ready to include in the returning HTML response.

set termout off
set pages 999

SET MARKUP HTML ON TABLE "class=emp cellspacing=0" ENTMAP OFF

col emp_name format a30 heading "

Emp Name

"
col salary   format $999,999 heading "

Salary

"

spool my_html.htm

select
   emp_name,
   salary
from
   emp e;

spool off;

 

This will spool the HTML to the my_html.htm file, ready for you to return to the client.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51673/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    449
  • 访问量
    319596