這是我在一個國外的網站上看到的
大家可以參考參考
SQL*Plus is primarily a character mode terminal application. However, since version 8.1.6, SQL*Plus has the ability to format its output in HTML format. To enable HTML output, use the command:
SQL> set markup html on
After it's turned on, several characters, such as >,
SQL> set markup html entmap off;
SQL>
When you issue a query, the results will be generated as an HTML TABLE, TR, and TD instead of as the usual formatted ASCII output:
SQL> select sysdate from dual;
SYSDATE |
---|
30-MAR-03 |
If you want to see the results as a preformatted HTML PRE element, use the option PREFORMAT ON:
SQL> set markup html preformat on;
SQL> select sysdate from dual;
SYSDATE
---------
30-MAR-03
If you specify SPOOL ON, SQL*Plus will generate headers to the spool file when you issue the SPOOL command.
You can change the HEAD tag contents, BODY tag, and TABLE tag attributes in the output by specifying those tag names as options:
SQL> set markup html head '' -
> body 'bgcolor="#FFFFFF"' -
> table 'width="100%" border=0'
SQL> select sysdate from dual;
SYSDATE |
---|
30-MAR-03 |
With MARKUP HTML ON enabled, the PAGESIZE, LINESIZE, TTITLE, BTITLE, and COLUMN commands are reflected in the HTML output.
You can enable MARKUP HTML commands and options from the command line, like this:
REM -- report.sql
select * from emp order by empno;
exit;
sqlplus -s -m "html on" scott/tiger @report > report.html
Using this method, you can run an old character mode SQL*Plus report and generate HTML without modifying the script.