Thursday, 12 September 2013

Parameterize the Decode Funcation

Parameterize the Decode Funcation

In a oracle Function im using an Decode Statement as below For security
reason i dont want the code to have the hardcoded value and i plan to
create a new lookup table.
Select CONCAT( Decode(A.COUNTRY_INITIAL,
'A','America','B','Brazil','F','FINLAND',NULL), Decode(A.ADD_VALUE,
'M','YES', NULL)
from (
Select SUBSTR(COUNTRY_BASE, -1,1) as COUNTRY_INITIAL,
Select SUBSTR(IS_VALUED, -1,1) as ADD_VALUE,
frorm TBL1
)A
Refernece Table
*******************
Clmn1 Clmn2 Clmn3
cntry1 A America
cntry2 B Brazil
cntry3 F Finland
Value1 M YES
Could you please let me know how i can incorporate this in the decode
logic. Also fyi im using this CODE SNIPPET in a Oracle FUNCAtion

No comments:

Post a Comment