转载:2015-01-17 15:32:33
http://www.cnblogs.com/FeiyueHang/archive/2011/03/08/1977729.html
1.NVL(expr1,expr2)
如果expr1为NULL,则该函数显示expr2的值;
2.NVL2(expr1,expr2,expr3)
如果expr1的值为NULL,则该函数显示expr3的值;不为NULL,显示expr2的值;
3.NULLIF(expr1,expr2)
如果expr1=expr2,返回NULL;若不等,则返回第一个表达式的值;
4.COALSECE(expr1,expr2,expr3)
如果全为NULL,则函数值为NULL;若有一项不为NULL,则显示那一项exprN;若三项都不为空,则显示最前面的一项expr;
5.
1 CASE 2 SELECT cust_last_name, 3 CASE credit_limit WHEN 100 THEN ‘Low‘ 4 WHEN 5000 THEN ‘High‘ 5 ELSE ‘Medium‘ END 6 FROM customers;
类似C语言的case
6.DECODE
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;
原文:http://www.cnblogs.com/Rainbow-G/p/4230500.html