Connecting Tech Pros Worldwide Forums | Help | Site Map

Conversion of CASE into DEcode

Newbie
 
Join Date: Aug 2005
Location: Pune, India
Posts: 23
#1: Sep 2 '05
Hello everyone,

[COLOR=Red]Please HELP !!!!![/COLOR]

I'm facing problem in converting CASE statements into DECODE. As i have PL/SQL 8i, so it does not handle CASE statements. Please send me the solutions . Then basic problem is the CASE has NOT condition i.e. <> ...... and this particularly i'm not able to convert in DECODE.

Please send me the solution as early as possible.. I'm stuck up !!!
I'm giving below the CASE statements and the DECODE statements which i have written and which have some problem.....

CASE statrement is:-

CASE
WHEN SUBSTR (CIL_GET_ACCOUNT_SEGS (ACD.CODE_COMBINATION_ID), 17, 7) <> '0032682'
THEN ACD.ACCTD_AMOUNT * -1
ELSE 0
END SERVICE_TAX

the DECODE which i wrote is :-

DECODE(SUBSTR (CIL_GET_ACCOUNT_SEGS (ACD.CODE_COMBINATION_ID), 17, 7) <> '0032682'),(ACD.ACCTD_AMOUNT* -1), 0) SERVICE_TAX


CASE statement:-

CASE
WHEN SUBSTR (CIL_GET_ACCOUNT_SEGS (ACD.CODE_COMBINATION_ID), 17, 7) <> '0032682'
THEN 'Service Tax 10%'
ELSE 'Cess- Ser tax2%'
END TAX_CODE

DECODE i wrote:

DECODE((SUBSTR (CIL_GET_ACCOUNT_SEGS (ACD.CODE_COMBINATION_ID), 17, 7) <> '0032682'), 'Service Tax 10%', 'Cess- Ser tax2%') TAX_CODE

Please let me know what is correct DECODE statement......

Reply