例:
SELECT product_id, DECODE (warehouse_id, 1, 'Southlake', 2, 'San Francisco', 3, 'New Jersey', 4, 'Seattle', 'Non domestic') "Location of inventory" FROM inventories WHERE product_id < 1775;
说明:如果warehouse_id值为1,则返回'Southlake';如果值为2,则返回'San Francisco';。。。如果1、2、3、4都不是,则返回'Non domestic'。
表达式:DECODE(expr, search, result [, search, result ]... [, default ] )