Link to home
Create AccountLog in
Avatar of YZlat
YZlatFlag for United States of America

asked on

How to write output to multiple html tables?

I have a ksh script that writes data from one view to a table in html file. I want to createan html file with multiple tables with data from different views in my database. how can I modify my script to accomplish that?

#!/usr/bin/ksh

export ORACLE_SID=DBName
ORAENV_ASK=NO
. oraenv
sqlplus -s /nolog <<EOF
CONNECT usr1/pwd
SET LINES 4000 TRIMS ON FEED OFF PAGES 49999
SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>SQL*Plus Report</title> -
<STYLE TYPE='TEXT/CSS'><!--BODY {background: ffffc6} --></STYLE>"
SET ECHO OFF
SPOOL myfile.html
SELECT * FROM my_view;
SPOOL OFF
EOF

Open in new window

Avatar of Sean Stuber
Sean Stuber

for each view spool to a new file


spool one.html
select * from view1;
spool off

spool two.html
select * from view2
spool off

etc
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of YZlat

ASKER

Is it possible to also right a heading for each table that would go right before each table?
>>Is it possible to also right a heading for each table that would go right before each table?

Using which method?  I'm still not sure exactly what your desired results are.

Headings are based on the column names.  For the methods above except for the union, column names should be what they are in the tables.
Avatar of YZlat

ASKER

I want something like that:

                Title here
---------------------------------------
|  field1  | field2    |firld3       |
---------------------------------------
|             |              |             |
____________________________


          Title for the second table
---------------------------------------
|  field1  | field2    |firld3       |
---------------------------------------
|             |              |             |
____________________________
>>I want something like that:

Still not answering all the questions:
One file for all tables, each table in a separate file?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of YZlat

ASKER

let me try that
You realize that if you answered the questions asked, we could provide a pretty close to 100% accurate answer.
Avatar of YZlat

ASKER

one file for all tables and there could be more than 2 tables
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of YZlat

ASKER

slightwv this is perfect! Thank you!
Avatar of YZlat

ASKER

slightwv this is perfect! Thank you!
wouldn't a split be in order?
I agree that a split should be awarded since sdstuber posted TTITLE.

I just showed you how to implement it once I got the complete requirements.
Avatar of YZlat

ASKER

sdstuber, I am sorry, I didn't notice you were the one who posted TTITLE first!