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: column name as a part of the result set

Re: column name as a part of the result set

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Thu, 12 Feb 2004 13:01:16 -0800
Message-ID: <1076619627.506557@yasure>


Tod wrote:

> Is it possible to get the column name as a part of the result in a
> query without using PL/SQL? I can use a procedure if necessary.
> Below is a simple example but the real tables have many more columns.
>
> Base_Table:
> ID_COL VAL_COL
> 1 One
> 2 Two
>
> Audit_Table:
> ID_COL VAL_COL
> 1 One
> 2 Too
>
> Select
> at.ID_COL,
> at.VAL_COL,
> column_name (this is what I need)
> From
> Audit_Table at,
> Base_Table bt
>
> Where
> bt.ID_COL = at.ID_COL
> and bt.VAL_COL != at.VAL_COL;
>
> The result set would be something like:
> ID_COL VAL_COL column_name
> 2 Too VAL_COL
>
> Any ideas?
>
> Thanks, Tod

Can not be done without hard coding.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Thu Feb 12 2004 - 15:01:16 CST

Original text of this message

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