DECODE Instead of combination of SUBSTR 'n' INSTR?
Hi All,
I need your help for below 2 issues...
1. In my procedure, i am passing ID as parameter. For some of the code there will be 2 ids. Both IDs will be same except the 2nd ID will contain ~01 as last 3 characters.
ex: 20090617123456
20090617123456~01
Now i need to get the CODE from one table. This table maintains only one entry for type1 and type2 IDs. Let's say, table has entry ID=20090617123456 and CODE=007.
i have written following WHERE condition
WHERE file_id = in_file_id -- in_file_id is input paremeter.
But for type2, if i want to fetch CODE, i have modified the above WHERE condition.
WHERE file_id = SUBSTR(in_file_id, 1, (INSTR(in_file_id, '~')-1))
The code is working fine, but user says, do it using DECODE function. I am not able to achive the result using DECODE function. Can someone tell how to use DECODE function for the same or any other way to do so?