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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Looking for a Sql statement

Re: Looking for a Sql statement

From: Douglas Whitacre <whitacre_at_imake.com>
Date: Thu, 14 Jan 1999 15:33:41 -0500
Message-ID: <77lkbe$1rj@world1.bellatlantic.net>


I can get you part of the way there. I can't give you the results in one row, but this will create a sql stmt and label each row accordingly;

set head off
set verify off
set echo off
spool test.sql
select 'select result " ' || lab || ' " from t where lab = ' ' ' || lab || ' ' ';'
from t;

spool off
set head on
set verify on
@test

This will produce:
(note: there is a double quote - single quote around the first LAB, and 3 single quotes around the second lab.)
hemoglobin


            10

wbc


            20

heart rate


           70

etc. to get all of that into one row would be very very difficult.

-----Original Message-----
From: thomasla5440_at_my-dejanews.com <thomasla5440_at_my-dejanews.com> Newsgroups: comp.databases.oracle.misc
Date: Thursday, January 14, 1999 1:03 PM Subject: Looking for a Sql statement

>Looking for a sql statement which will take column 1 and column 2 from
table A
>and make column 1 the header and column 2 the 1 row of data.
>
>example: LAB RESULT
> hemoglobin 10
> wbc 20
> heart rate 70
> height 165
>
>etc, ...
>and you want a report -
>hemoglobin wbc heart rate height etc, ...
>10 20 70 165
Received on Thu Jan 14 1999 - 14:33:41 CST

Original text of this message

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