Since this article was released there have been a number of improvements to the formatting functionality in SQL*Plus, and SQLcl has a large number built-in output format. You should probably read the following articles as they contain updated information.
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. The MARKUP 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.
SET ECHO OFF SET MARKUP HTML ON SPOOL ON SPOOL emp1.html SELECT * FROM emp; SPOOL OFF SET MARKUP HTML OFF SET ECHO ON
If this code is run from within a SQL*Plus session the resulting HTML file will look like this: emp1.html.
Alternatively, the script can saved as EmpHTMLReport.sql and run from the command line.
sqlplus scott/tiger@w2k1 @EmpHTMLReport.sql
The resulting HTML file will look like this: emp2.html.
Alternatively, an individual query can be saved to EmpSQL.sql and run with the appropriate command line parameters.
sqlplus -S -M "HTML ON" scott/tiger@w2k1 @EmpSQL.sql>emp3.html
The resulting HTML file will look like this: emp3.html.
For more information see:
Hope this helps. Regards Tim...
Back to normal view: https://oracle-base.com/articles/9i/sqlplus-web-reports