DECODE() to compare 1 to 2, and since they are not equal 3 is returned : Decode « PL SQL « Oracle PL / SQL






DECODE() to compare 1 to 2, and since they are not equal 3 is returned


SQL>
SQL> --DECODE() to compare 1 to 2, and since they are not equal 3 is returned:
SQL>
SQL> SELECT DECODE(1, 2, 1, 3)
  2  FROM dual;

DECODE(1,2,1,3)
---------------
              3

SQL>
           
       








Related examples in the same category

1.Use decode function to deal with NULL value
2.DECODE(x, search, result, default)
3.DECODE() allows you to perform if-then-else logic in SQL without having to use PL/SQL
4.If city equals 'New York', the string 'You are in New York' is returned, otherwise the string 'Not' is returned
5.Multiple search and result parameters to DECODE()