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: Tod <dontbotherspammers_at_yahoo.com>
Date: 15 Feb 2004 15:58:23 -0800
Message-ID: <f85005b4.0402151558.7eeaff41@posting.google.com>


"Anurag Varma" <avdbi_at_hotmail.com> wrote in message news:<lN3Xb.56466$n62.37165_at_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

Hmm, this looks worth a try.

Thanks, Tod Received on Sun Feb 15 2004 - 17:58:23 CST

Original text of this message

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