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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Nested Decodes Help

Re: Nested Decodes Help

From: Tom Leary <tleary1_at_uswest.net>
Date: Sun, 3 Dec 2000 00:58:38 -0800
Message-ID: <Z8mW5.3267$tR6.575348@news.uswest.net>

I don't know what the dirreps and hrreps mean, but

Try

DECODE( a1.supervisor_id||'dirreps', '1005940hrreps', 'SUPER', --Handles first case, second case is handled by Else (nested Decode)..

      DECODE( a1.manager_id||'dirreps', '1005940hrreps', 'SUPERMAN',
            DECODE( a1.hr_responsible_id, '1005940', 'HRMAN',     -- First
part of Or
                  DECODE( 'hrreps', 'hrreps', 'HRMAN',
                        NULL )   --Assuming you want null returned if no
case matches
                             )
                        )
                  )


<battists_at_bsci.com> wrote in message news:90bqoa$pv3$1_at_nnrp1.deja.com...
> Howdy folks,
>
> I'm having some trouble with nested decodes. I have a Case statement
> from MS SQL server that I'm trying to translate into Oracle using
> nested decodes:
>
> case when (a1.supervisor_id='1005940' and 'dirreps'='hrreps')
> then 'SUPER' when (a1.manager_id='1005940' and 'dirreps'='hrreps')
> then 'SUPERMAN' when (a1.hr_responsible_id='1005940'
> or 'hrreps'='hrreps') then 'HRMAN'
>
> But I'm just not very familiar with nested decodes - I keep getting
> confused. (^_^) Any ideas as to how to approach this?
>
> Steve Battisti
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Sun Dec 03 2000 - 02:58:38 CST

Original text of this message

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