OCP-1Z0-051-题目解析-第44题

44. View the Exhibit and examine the structure of the ORD table. 


Evaluate the following SQL statements that are executed in a user session in the specified order: 
CREATE SEQUENCE ord_seq; 
SELECT ord_seq.nextval 
FROM dual; 
INSERT INTO ord 
VALUES (ord_seq.CURRVAL, '25-jan-2007',101); 
UPDATE ord 
SET  ord_no= ord_seq.NEXTVAL 
WHERE cust_id =101; 
What would be the outcome of the above statements?  
A. All the statements would execute successfully and the ORD_NO column would contain the value 2 for 
the CUST_ID 101. 
B. The CREATE SEQUENCE command would not execute because the minimum value and maximum 
value for the sequence have not been specified. 
C. The CREATE SEQUENCE command would not execute because the starting value of the sequence 
and the increment value have not been specified. 
D. All the statements would execute successfully and the ORD_NO column would have the value 20 for 

the CUST_ID 101 because the default CACHE value is 20. 


Answer: A 

创建序列器的时候如果不带任何参数,默认的起始值是1,没有最大值,步长是1、
A:所有语句都能正确执行,CUST_ID 101的ORD_NO的值是2(正确)
B:序列器创建语句不能执行,因为序列器的最小值和最大值没有指定(错误,默认最小值为1,无最大值)
C:序列器创建语句不能执行,因为序列器的起始值和步长没有指定(错误,起始值为1,步长为1)
D:所有语句都能正确执行,CUST_ID 101的ORD_NO的值是20,因为默认的CACHE是20(错误,默认的cache是20,但只是一次性取20个序列到内存中,如果内存崩溃,序列器将会从21开始。)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值