SQL>
SQL> --Using the DECODE() Function
SQL>
SQL> --You use DECODE(value, search_value, result, default_value) to compare value with search_value. If the values are equal, DECODE() returns result, otherwise default_value is returned.
SQL>
SQL> --DECODE() allows you to perform if-then-else logic in SQL without having to use PL/SQL.
SQL>
SQL>
SQL> SELECT DECODE(1, 1, 2, 3)
2 FROM dual;
DECODE(1,1,2,3)
---------------
2
SQL>
|