Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: decode statement
Hi:
You can't put two colums is a decode. You must do the next:
decode( BUSINESS_CD, '71', decode( PAID_CD, 'H' , 'IL', 'NOT IN LIST' ), 'NOT IN LIST' ) This do:
if BUSINESS_CD=71 then it's looks if PAID_CD='H' then 'IL', else 'NOT IN
LIST'
if BUSINESS_CD<>71 --> 'NOT IN LIST'
I hope it's usefull to you.
Regards,
Isa
"gareth hoy" <ghoy_at_yourplus.com> escribió en el mensaje
news:e034dbf5.0302250233.1191bedd_at_posting.google.com...
> Hi,
>
> i have the following decode statement:
> select DECODE(BUSINESS_CD, PAID_CD,'71','H','IL','NOT IN LIST')
> from FINREPDBA.T_COMMISSION_TXN;
>
> What i want to do is to be able to select a value of IL when
> business_cd =71 and paid_cd=H.
>
> I was using the statement:
> select DECODE(BUSINESS_CD,'71','IL','NOT IN LIST')
> from FINREPDBA.T_COMMISSION_TXN;
> this worked fine.
>
> What am i doing wrong? How can you add a second column into a decode
> statement?
>
> thanks,
> Gareth
Received on Tue Feb 25 2003 - 04:59:19 CST