René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
|
August 19, 2006: On generating HTML output with SQL*Plus | ||
SQL*Plus generates HTML output if it is invoked with the -m flag.
In order to demonstrate that, I am going to create a table:
create table html_output_ex ( a number, b varchar2(20), c date );
I insert some values into the table. Some values contain HTML markup (<b>, </b> <i> and </i>):
insert into html_output_ex values (1, 'foo' , sysdate - exp(1)); insert into html_output_ex values (2, '<b>bold</b>' , sysdate - exp(2)); insert into html_output_ex values (3, '<i>italic</i>', sysdate - exp(3)); commit;
Here's the script that I will execute from within SQL*Plus. It is very simple: a select statement followed by the
SQL*Plus exit command so that SQL*Plus returns to the prompt when
the select statement has finished.
gen_html.sql
I execute SQL*Plus and pass the following parameters:
The generated output is displayed in the following
<iframe> . Because I have specified entmap off, the strings
'bold' and 'italic' appear bold and italic, respectively:
Now, I do the same thing, but with entmap on;
This returns the strings as actually inserted into the table, that is the < and > are translated into < and
>
More on OracleThis is an on Oracle article. The most current articles of this series can be found here.
|