By: Prem Tiwari | Last Updated: | In: Mysql, Oracle
This post explains how to generate a HTML reports from your Sql *plus query results. You can produce HTML output in AN interactive SQL*Plus session victimization the SET MARKUP command. you\’ll be able to embrace AN embedded sheet, or the other valid text within the HTML tag.
SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON –
1 2 3 4 5 6 |
HEAD "<TITLE>Department Report</TITLE> - <STYLE type='text/css'> - <!-- BODY {background: #FFFFC6} --> - </STYLE>" - BODY "TEXT='#FF00Ff'" - TABLE "WIDTH='90%' BORDER='5'" |
1 2 3 |
SELECT '<A HREF="http://oracle.com/'||DEPARTMENT_NAME||'.html">'||DEPARTMENT_NAME||'</A>' DEPARTMENT_NAME, CITY FROM EMP_DETAILS_VIEW WHERE SALARY>12000; |
SPOOL OFF
The and tags area unit appended to the spool file, report.html, before it’s closed.
The output from report.sql may be a file, report.html, which will be loaded into an online browser. Open report.html in your application program. It ought to seem one thing just like the following:
Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies. View all posts by Prem Tiwari
generate database reports, HTML 5, html reports for sql database