The Oracle and PL/SQL DECODE function compares expr to each search value one by one. If expr is equal to a search, then function returns the corresponding result. If no match is found, then DECODE returns default. If default is omitted, then DECODE returns null.
The general format is:
DECODE(expr, value1 [, return1, value2, return2....,] default )
Example 1:
SELECT DECODE(STATUS,0,'good',1,'medium','bad') FROM INVOICE;
returns:
good
bad
bad
medium