/* File: sqlplus-reporter.sql v1.0.0 docs at the end */
/* do not print echo commands */
set echo off
/* do not require feedback from the user */
set feedback off
/* set a nice prompt */
set sqlprompt ''
/* -- separate columns with a comma */
set colsep ';'
/* -- only one header row */
set pagesize 0
/*-- remove trailing blanks */
set trimspool on
/* REMOVE THE WHITE SPACE */
set trimout on
/* -- this may or may not be useful...depends on your headings. */
set headsep ON
/* how- long the line should be */
set linesize 3000
/* print the headers as well */
set heading on
/* request full html for output */
/* set markup html on spool off */
/* define the file where the output of the results should be stored */
spool "&1..html"
-- START SQL
select '<html> <head> <title>tables</title> <style type="text/css"> table tbody tr td { background-color: #eee; } table tr.odd td { background-color: #fff; } </style> </head><body><table>
' from dual ;
-- specify grey ( #CCC ) and white colors
-- open the row
select '<tr class="'
|| CASE mod(rownum,2) WHEN 0 THEN 'odd' ELSE 'even' END
|| '">'
-- print a single table cell
|| ' <td>' || OWNER || '</td>'
-- print another single table cell
|| ' <td>' || TABLE_NAME || '</td>'
-- close the row
|| '</tr>' FROM
-- IF YOU NEED ORDER BY CLAUSE AS WELL,
(
SELECT OWNER , TABLE_NAME FROM ALL_TABLES ORDER BY OWNER , TABLE_NAME
)
;
select '</table></body></html>' from dual ;
-- STOP SQL
spool off ;
/* exit the sqlplus tool */
EXIT 0;
/*
Purpose:
- to provide a single sql statement to run agains an oracle database
- to output a single file passed as the first argument to the script
VersionHistory:
1.1.0 --- 2012.04.08 - 23:04:19 --- ysg --- Added order by clause
1.0.0 --- 2012.04.08 - 22:07:19 --- ysg --- Initial creation
*/
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!