Re: SQLPlus output format

From: Ian Dixon <uidixon!idixon_at_infocom.co.uk>
Date: 17 May 93 19:36:52 GMT
Message-ID: <6NLP4B1w165w_at_uidixon.uucp>


paulk_at_spock.dis.cccd.edu (Paul Krikorian) writes:

> Hi, could anybody tell me if it is possible to get SQLPlus to display
> the result of a SELECT statement in the following format:
>
> column_1 = value
> column_2 = value
> .
> .
> .
> column_n = value
>

If I read what you want to do correctly, the following should do the trick:

rem * Print columns down the page

rem * fold_after tells SQL*Plus to skip a line after printing the column

column COLUMN_1     fold_after
column COLUMN_2     fold_after

.
.
column COLUMN_n fold_after

rem * Suppress column headings
set heading off

rem * I guess a gap between the rows returned would make it more readable so break on ROW skip PAGE

select 'Column 1 = ',

       COLUMN_1,
       'Column 2 = ',
       COLUMN_2,
       .
       .
       'Column n = ',
       COLUMN_n

from TABLE
where <your conditions>
/

I think that's right but I don't have a copy of Oracle here to try out the syntax. This works for the version of SQL*Plus that comes with the PC toolset(version 3 point something) but I also recall do a similar kind of thing with an earlier version on a VAX. That didnt use fold_after but it had the same effect.

> Any help would be appreciated.
> Thanks in advance.
>

You're welcome

Regards

Ian

--
Ian Dixon                       Email : idixon_at_infocom.co.uk
Reading, England
Received on Mon May 17 1993 - 21:36:52 CEST

Original text of this message