Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Oracle / Oracle Server / January 2008

Tip: Looking for answers? Try searching our database.

generate html report using sqlplus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
maks71@gmail.com - 15 Jan 2008 21:12 GMT
Needed help to generate following report in html using preferably
sql*plus leveraging  it's built-in html reporting  functionality
(i.e.set markup html on ) but open for any other solutions as well..

Here is the SQL for the report.

with top_etime_sqls as
  (select sql_id, instance_number inst#, sum(elapsed_time_delta/
1000000)/greatest(sum(executions_delta),1)  etime_secs
   from dba_hist_sqlstat
   where snap_id in (select snap_id from dba_hist_snapshot where
begin_interval_time > trunc(sysdate-1))
   group by sql_id, instance_number
   having sum(elapsed_time_delta/1000000)/
greatest(sum(executions_delta),1) > 1000
   )
select tsqls.sql_id, tsqls.inst#, etime_secs, stxt.sql_text , t1.*
from dba_hist_sqltext stxt, top_etime_sqls tsqls,
table(DBMS_XPLAN.DISPLAY_AWR(tsqls.sql_id)) t1
where stxt.sql_id = tsqls.sql_id
order by 1, 2, 3

Here is how I'm expecting output  for above sql.

*  sql_id, inst# , etime_secs  --  This should be in one html row & 3
html columns.
*  complete output of stxt.sql_text for above sql_id  should be in
next row ( i.e. in one long html column ). It would be nice if it can
maintain the format of origional SQL statement from v
$sql.sql_fulltext
* Then next rows should have full Explain plan out from
dbms_explain.display_awr(v$sql.sql_id) for sql_id above.

again
sql_id, inst#, etime_secs in one html row.
complete outout of sql_text in next html row
complete explain plan in next html row.

and so on...

Thanks in advance for your help.
-Mak
Peter Teoh - 18 Jan 2008 04:53 GMT
Using sqlplus, and if u have access to the htp and htf package, it
should be no problem generating HTML, for example, look at the file
$ORACLE_HOME/rdbms/admin/privutil.sql, and search for all the htp.*
function usage, and u can get the idea how it uses htp functions to
generate HTML structure contents.

For example:

    htp.preOpen;
        htp.prints(translate(text,NL_CHAR,' '));
     htp.preClose;

And this:

        htp.print('</PRE>');
          htp.p(htf.format_cell(columnValue, format_numbers));
                   htp.tableRowOpen;
                   htp.tableRowClose;
              htp.tableRowOpen;
              htp.tableRowClose;
           htp.formSelectOpen( cname => p_cname,
                 htp.formSelectOption( cvalue => nc_visible,
           htp.formSelectClose;

etc.
maks71@gmail.com - 23 Jan 2008 13:50 GMT
> Using sqlplus, and if u have access to the htp and htf package, it
> should be no problem generating HTML, for example, look at the file
[quoted text clipped - 21 lines]
>
> etc.
Thanks for the valuable tips..
where will htp.print will print? On screen? I would like to generate
the report on client side as I don't have access to server...
fitzjarrell@cox.net - 23 Jan 2008 16:19 GMT
On Jan 23, 7:50 am, mak...@gmail.com wrote:

> > Using sqlplus, and if u have access to the htp and htf package, it
> > should be no problem generating HTML, for example, look at the file
[quoted text clipped - 27 lines]
>
> - Show quoted text -

Most likely on the server, as that is where Oracle DIRECTORY objects
are defined and I doubt that you have an NFS mount from the db server
to the client.

David Fitzjarrell
maks71@gmail.com - 29 Jan 2008 19:28 GMT
On Jan 23, 11:19 am, "fitzjarr...@cox.net" <fitzjarr...@cox.net>
wrote:
> On Jan 23, 7:50 am, mak...@gmail.com wrote:
>
[quoted text clipped - 37 lines]
>
> - Show quoted text -

Is there a html tag that retain the output of DBMS_XPLAN.DISPLAY ..
i.e. CR, LF, SPACES and TABS as it is..
sybrandb@hccnet.nl - 29 Jan 2008 21:32 GMT
>On Jan 23, 11:19 am, "fitzjarr...@cox.net" <fitzjarr...@cox.net>
>wrote:
[quoted text clipped - 42 lines]
>Is there a html tag that retain the output of DBMS_XPLAN.DISPLAY ..
>i.e. CR, LF, SPACES and TABS as it is..

Actually you don't need to use htp.print.
Sql*plus has for quite some time the command
set markup html spool on.
(From memory).
You need to verify this in the sql*plus users and reference manual.
Apart from that: isql*plus generates html output by default.

Signature

Sybrand Bakker
Senior Oracle DBA

shakespeare - 30 Jan 2008 11:25 GMT
>>On Jan 23, 11:19 am, "fitzjarr...@cox.net" <fitzjarr...@cox.net>
>>wrote:
[quoted text clipped - 50 lines]
> You need to verify this in the sql*plus users and reference manual.
> Apart from that: isql*plus generates html output by default.

The OP mentioned that in his post...

Shakespeare
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.