SQL*Plus Web Reports
Both Oracle8i and Oracle9i allow the generation of HTML directly from SQL*Plus. This can be used to build complete reports, or output to be embedded in larger reports. TheMARKUP HTML ON statement tell SQL*Plus to produce HTML output. The SPOOL ON option
of this command indicates that the results should be encapsulated in
<html><body>...</body></html> tags. If a complete HTML page is not required the
SPOOL OFF option can be used.The following example displays the contents of the
SCOTT.EMP table as a HTML table:If this code is run from within an SQL*Plus session the resulting HTML file will look like this: emp1.html.SET ECHO OFF SET MARKUP HTML ON SPOOL ON SPOOL emp1.html SELECT * FROM emp; SPOOL OFF SET MARKUP HTML OFF SET ECHO ON
Alternatively, the script can saved as EmpHTMLReport.sql and run from the command line:
The resulting HTML file will look like this: emp2.html.sqlplus scott/tiger@w2k1 @EmpHTMLReport.sql
Alternatively, an individual query can be saved to EmpSQL.sql and run with the appropriate command line parameters:
The resulting HTML file will look like this: emp3.html.sqlplus -S -M "HTML ON" scott/tiger@w2k1 @EmpSQL.sql>emp3.html
For further information see:
Hope this helps. Regards Tim...
Back to the Top.
