Select with case and decode with different columns [closed]

0

I want to make a query with a case and decode in the same selection with different columns so that:

select NOMBRE, 
case when DESDE >= 0000 THEN    decode(DIA,'0','DOM','1','LUN','2','MAR','3','MIER','4','JUE','5','VIE','6','SAB','ALL','TODOS') 
ELSE 'FALSO'as PLAN, 
 from  CALENDARIO j
where SCRIPT like '%prueba%';

But it gives me a missing keyword error. Can this be done? Is there any more optimal way? Thanks

    
asked by user104906 31.08.2017 в 18:26
source

1 answer

1

Yes it can be done, but you missed the END to close the CASE and you have an extra comma.

SELECT NOMBRE, 
CASE WHEN DESDE >= 0000 THEN DECODE(DIA,'0','DOM','1','LUN','2','MAR','3','MIER','4','JUE','5','VIE','6','SAB','ALL','TODOS') 
ELSE 'FALSO' END AS PLAN
 FROM CALENDARIO j
WHERE SCRIPT LIKE '%prueba%';
    
answered by 31.08.2017 / 23:40
source