Display SQL*Plus output in your web browser
The SQL*Plus HTMLizer is an idea from Tanel Poder. Read his original 2007 blog post here.
I was using my copy recently after not looking at it for a while, and I felt that the fonts and colours could do with a bit of smartening up. Whether the result is an improvement or not I'll leave to you to decide, but anyway here's my version in a slightly less brutal visual style.
What we can't easily change is the way SQL*Plus truncates the names of short text columns to fit the column width - you'll have to correct that manually using standard SQL*Plus column formatting. We also can't left- or right-align headings depending on the datatype, so headings for long text columns float awkwardly in the centres of their columns. But, it's a super-easy way to get a readable data listing right from the command line.
set termout off feedback off set markup html on head "<title>SQL*Plus Output &_user@&_connect_identifier &_date</title> - <!-- Generated by html.sql on &_DATE for user &_USER.@&_CONNECT_IDENTIFIER --> - <style> - html { - font-family: consolas, monospace; - font-size: 9pt; - background-color: #dce1e9; - } - table, td, th { - vertical-align: top; - border: 1px solid #808090; - background: white; - padding: .5em .6em; - } - table { - border-collapse: collapse; - margin-top: 1.2em; /* space above table itself */ - margin-bottom: 1.2em; - border-width: 3px; - margin-bottom: 1em; - } - td { - margin: .2em; - font-size: 80%; - } - th { - background: #f0f4fd; - font-weight: bold; - font-size: 95%; - margin: .2em; - padding-bottom: .4em; - } - </style>" - body "" - table "align='center' summary='Script output'" - spool on entmap on preformat off spool sqlplus_output.html run spool off set markup html off spool off host start sqlplus_output.html set termout on feedback on
Now, you can just enter any SQL into the SQL*Plus buffer and then call @html
:
...and the results appear in your default browser:
See also: Setting up SQL*Plus on Windows.