I have a table like this below:
SL1 COL 1 COL2 COL3 1 ABC Yes Yes 2 XYZ Yes Yes 3 ABC NULL Yes 4 NULL Yes YES 5 XYZ Yes NULL 6 NULL NULL NULL
COL1 = 'ABC' and 'XYZ' then it should be decoded as 3 COl2 IS NOT NULL then it should be decoded as 10 COL3 is not null then it should decoded as 25
Example: when we fetch the result of the SL1 it should return 3:10:25
REsults 3:10:25 3:10:25 3:25 10:25 3:10 NULL
I have written the query like this
select Decode(COL1,'ABC','4','XYZ','3') ||':' || decode (COL2, 'Yes','10') || ':' || decode(COL3,'Yes','25')
from temp;
Aucun commentaire:
Enregistrer un commentaire