Spool SQL query output to HTML format in SQLPLUS Oracle
Generate the simple SQL into HTML form
set pages 500
SET MARKUP HTML ON
spool report1.html
Select * from hr.departments where department_id < 20;
spool off
SAMPLE OUTPUT: REPORT1.HTML
Generate the html report with background color by using CSS from SQL QuerySET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON -
Sample output : REPORT2.HTML
HEAD "<TITLE>EMPLOYEE REPORT</TITLE> -
<STYLE type='text/css'> -
<!-- BODY {background: #FFFFC6} --> -
</STYLE>" -
BODY "TEXT='#FF00Ff'" -
TABLE "WIDTH='90%' BORDER='5'"
spool C:\report2.html
Select * from hr.departments where department_id < 20;
spool off
Generate html report by executing directly with SQLPLUS
--Execute directly with SQLPLUS
SQLPLUS -S -M "HTML ON TABLE 'BORDER="2"'" HR/your_password@Oracle_sid @C:\d\departments.sql > report3.html
--Save in file Departments.sql
Select * from hr.departments where department_id < 20;
EXIT
SAMPLE OUTPUT: REPORT3.HTML

Great!!!
LikeLike