95.The PRODUCTS table has the following structure:

来源:互联网 发布:ps淘宝字体百度云 编辑:程序博客网 时间:2024/04/29 22:25
95.The PRODUCTS table has the following structure:
name                Null       Type
PROD_ID             NOT NULL   NUMBER(4)
PROD_NAME                      VARCHAR2(25)
PROD_EXPIRY_DATE               DATE


Evaluate the following two SQL statements:
SQL>SELECT prod_id, NVL2(prod_expiry_date, prod_expiry_date + 15,'') FROM products;
SQL>SELECT prod_id, NVL(prod_expiry_date, prod_expiry_date + 15) FROM products;


Which statement is true regarding the outcome?
A.Both the statements execute and give different results.
B.Both the statements execute and give the same result.
C.Only the first SQL statement executes successfully.
D.Only the second SQL statement executes successfully.
答案:A
解析:
nvl2(expr1,expr2,expr3):expr1为null,返回expr3,否则返回expr2
nvl(expr1,expr2):expr1为null,返回expr2
0 0
原创粉丝点击