OCP 1Z0 051 163

来源:互联网 发布:验证域名所有权的方法 编辑:程序博客网 时间:2024/05/21 17:47
163. View the Exhibit and examine the description for the CUSTOMERS table. 
You  want  to  update  the  CUST_CREDIT_LIMIT  column  to  NULL  for  all  the  customers,  where 
CUST_INCOME_LEVEL has NULL in the CUSTOMERS table. Which SQL statement will accomplish the 
task? 

A. UPDATE customers 
SET cust_credit_limit = NULL 
WHERE CUST_INCOME_LEVEL = NULL; 
B. UPDATE customers 
SET cust_credit_limit = NULL 
WHERE cust_income_level IS NULL; 
C. UPDATE customers 
SET cust_credit_limit = TO_NUMBER(NULL) 
WHERE cust_income_level = TO_NUMBER(NULL)
D. UPDATE customers 
SET cust_credit_limit = TO_NUMBER(' ',9999) 
WHERE cust_income_level IS NULL; 

现oracle中空字符串的值是NULL,但空格不是。D中的就是空格。
NULL 值不能用等号 大于 小于 比较,只能用 IS NULL、IS NOT NULL。
TEST >select count(*),count(comm) from emp;  COUNT(*) COUNT(COMM)---------- -----------        14           41 row selected.TEST >select * from emp where comm > null;no rows selectedTEST >select * from emp where comm < null;no rows selectedElapsed: 00:00:00.01TEST >select * from emp where comm = null;no rows selectedTEST >select empno,comm from emp where comm is not null;     EMPNO       COMM---------- ----------      7499        300      7521        500      7654       1400      7844          04 rows selected.

to_number(null)结果仍然是NULL
TEST >set null NULLTEST >select to_number(null) from dual;TO_NUMBER(NULL)---------------NULL1 row selected.


Answer: B 
0 0
原创粉丝点击