开发者

How to specify HTML doctype in Oracle SQL*Plus HTML report?

开发者 https://www.devze.com 2022-12-12 10:53 出处:网络
I\'m producing an HTML report from a query using: set markup html on table \"WIDTH=\'100%\' BORDER=\'1\'

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">

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">


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


Why not simply put a

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消