Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: formatting the results

Re: formatting the results

From: Douglas Hawthorne <douglashawthorne_at_yahoo.com.au>
Date: Sat, 19 Jun 2004 06:42:41 GMT
Message-ID: <BfRAc.41677$sj4.37177@news-server.bigpond.net.au>


"Vince Laurent" <vincelaurent_at_sbcglobal.net> wrote in message news:s4guc0dnqc6kup45raa9sqkjutgf5u8t9p_at_4ax.com...
> I have a query which looks like this:
>
> SQL> select count(status) from v$session group by status;
>
> 15
> 623
>
> But I would like the output to look like this:
>
> 15 623
>
> And I would like to add
>
> SQL> select to_char(sysdate, 'HH24:MI') from dual;
>
> 13:35
>
> to the line as well. So I finally get something like:
>
> 13:35 15 623
>
> Ideas? Web sites/docs to check out?
> Thanks!
>

Vince,

The first is a case of a pivot query. See asktom.oracle.com for examples. See "Pivot Query" (p.576 ff) in Chapter 12 "Analytic Functions" of "Expert One-on-One Oracle" by Thomas Kyte (A-Press:2003).

The second is just adding another column to the projection (i.e. the list of columns after the SELECT keyword).

Douglas Hawthorne Received on Sat Jun 19 2004 - 01:42:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US