Nested Decodes [message #371759] |
Sat, 02 December 2000 15:48 |
Steve Battisti
Messages: 2 Registered: December 2000
|
Junior Member |
|
|
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'
Any ideas as to how to approach this?
Steve Battisti
|
|
|
Re: Nested Decodes [message #371760 is a reply to message #371759] |
Sun, 03 December 2000 05:38 |
J.S HAN
Messages: 12 Registered: November 2000
|
Junior Member |
|
|
Hi,
I guess something wrong.
'dirreps'='hrreps' is always false.
so,is
decode(a1.hr_responsible_id,'1005940' ,'HRMAN')
anyway.
case when (A = 'A') then 'R_A'
when (B = 'B') then 'R_B'
when (C = 'C') then 'R_C'
--->
DECODE(A,'A','R_A',DECODE(B,'B','R_B'),DECODE(C,'C','R_C'))
|
|
|