views:

213

answers:

2

I'm producing an HTML report from a query using:

set markup html on table "WIDTH='100%' BORDER='1'
cellpadding='2px' cellspacing='0px'";

Is there a way of including a doctype declaration such as:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd"&gt;

I've searched but I can't see an obvious way of doing this.

UPDATE: Simply adding a prompt with a doctype produces the following (which produces another validation error!):

<html>
    <head>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
        <style type="text/css">pre{background-color:white;font-family:"Courier New";font-size:16;color:black;}</style>
    </head>
<body>
    <pre>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
A: 

Why not simply put a

prompt <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd"&gt;

in your script, BEFORE the set markup html on statement?

ammoQ
+1  A: 

I assume you're executing from the command line something like this:

SQLPLUS -S -M "HTML ON" user/password@yourDB @yourQuery.sql > output.html

What you can do is add some shell scripting to concatenate the DOCTYPE and the report. Let's assume the doctype is being put in a file DOCTYPE.TXT. You don't specify an environment, but let's try... Windows. Then we would have

SQLPLUS -S -M "HTML ON" user/password@yourDB @yourQuery.sql > intermediate.html
COPY DOCTYPE.TXT+intermediate.html output.html
Adam Hawkes
Cracking idea - cheers!
Umber Ferrule