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: Anurag Varma <avdbi_at_hotmail.com>
Date: Fri, 13 Feb 2004 12:53:37 GMT
Message-ID: <lN3Xb.56466$n62.37165@twister.nyroc.rr.com>

"Tod" <dontbotherspammers_at_yahoo.com> wrote in message news:f85005b4.0402130440.e23fbaf_at_posting.google.com... --snip--
> Not possible to use SP w/o PL/SQL, of course, just dumb typing on my
> part.
>
> I know VAL_COL in this example but I will have 30 columns in the real
> situation. I want to know only (and all) the column names where the
> value in "at" is different than the value in "bt".
>
> Thanks

You can try something like this:

select a.id, a.val1, a.val2, .......,

          decode(a.val1, b.val1, 'VAL1',null) val1,
          decode(a.val2, b.val2, 'VAL2',null) val2,
           .....

from a, b
where a.id = b.id
/

It should spit out the column name if the values are different. ...
Anurag Received on Fri Feb 13 2004 - 06:53:37 CST

Original text of this message

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