The DECODE function compares an expression against search conditions. If a match is found, it returns the corresponding results. If no match is found, it returns the default value (if defined) or NULL (if no default value is defined). The DECODE expression is similar to the CASE expression.
Example: Using the DECODE function in a query
obclient> SELECT id, abbr, decode(abbr, 'US','America', 'UK', 'English', 'CN', 'China', 'UNKOWN') full_name
FROM t_case;
+----+------+-----------+
| ID | ABBR | FULL_NAME |
+----+------+-----------+
| 1 | US | America |
| 2 | UK | English |
| 3 | CN | China |
| 4 | JP | UNKOWN |
+----+------+-----------+
4 rows in set (0.00 sec)
obclient>