ORACLE IIF Statement

后端 未结 3 1217
失恋的感觉
失恋的感觉 2020-12-01 13:48

I get an error while writing the IIF statement, table and the statement given below.

Statement:

SELECT IIF(EMP_ID=1,\'True\',\'False\') from Employee;
         


        
3条回答
  •  醉酒成梦
    2020-12-01 14:27

    Oracle doesn't provide such IIF Function. Instead, try using one of the following alternatives:

    DECODE Function:

    SELECT DECODE(EMP_ID, 1, 'True', 'False') from Employee
    

    CASE Function:

    SELECT CASE WHEN EMP_ID = 1 THEN 'True' ELSE 'False' END from Employee
    

提交回复
热议问题