"Orr, Steve" wrote: > > I want to display V$SYSSTAT row values in columns. The current query: > --------------------------------------------------------------------- > select to_char(trunc(86400*(sysdate-to_date( > '01/01/70','mm/dd/rr hh24:mi:ss')))), > 'stat38:stat39:stat40:stat41:stat44:stat105:'|| > 'stat106:stat158:stat159:stat188:stat189:stat190', > max(decode(se.statistic#, 38,se.value,0))||':'|| > max(decode(se.statistic#, 39,se.value,0))||':'|| > max(decode(se.statistic#, 40,se.value,0))||':'|| > max(decode(se.statistic#, 41,se.value,0))||':'|| > max(decode(se.statistic#, 44,se.value,0))||':'|| > max(decode(se.statistic#,105,se.value,0))||':'|| > max(decode(se.statistic#,106,se.value,0))||':'|| > max(decode(se.statistic#,158,se.value,0))||':'|| > max(decode(se.statistic#,159,se.value,0))||':'|| > max(decode(se.statistic#,188,se.value,0))||':'|| > max(decode(se.statistic#,189,se.value,0))||':'|| > max(decode(se.statistic#,190,se.value,0)) > from V$sysstat se > where se.statistic# in(0,38,39,40,41,44,105,106,158,159,188,189,190) > group by to_char(trunc(86400*(sysdate-to_date( > '01/01/70','mm/dd/rr hh24:mi:ss')))), > 'stat38:stat39:stat40:stat41:stat44:stat105:'|| > 'stat106:stat158:stat159:stat188:stat189:stat190'; > --------------------------------------------------------------------- > > Is there a better way to do this? > > This Best SQL Contest sponsored by... > Steve Orr, > Bozeman, MT
1 select sum(decode(statistic#, 38, value, 0)) stat38,
2 sum(decode(statistic#, 39, value, 0)) stat39
3* from v$sysstat
SQL> /
STAT38 STAT39
---------- ----------
454 7567
Since I suspect you of wanting the date (why the Unix format?) at the
beginning of the line to load everything into
your-favourite-spreadsheet-here and impress higher levels of the food
chain with dazzling graphics, something like this might better suit your
needs :
1 select sysdate, stat38, stat39
2 from (select sum(decode(statistic#, 38, value, 0)) stat38,
3 sum(decode(statistic#, 39, value, 0)) stat39
4* from v$sysstat)
SQL> /
SYSDATE STAT38 STAT39
--------- ---------- ----------
07-MAR-02 474 7633
--
HTH,
Stephane Faroult
Oriole Ltd
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Stephane Faroult
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
<<winmail.dat>>
