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

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:
44.View the Exhibit and examine the structure of the ORD table._第1张图片
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.
答案:A
解析:创建序列如果没有指定起始值,那么默认为最小值,如果最小值也没有制定那么默热为1,如果没有指定步长,那么默认为1
当创建完一个序列后,必须通过nextval初始化该值,初始化的值也就是起始值,
因此,创建完序列后,第一个select输出的应该是1,insert也是1 ,update的是2 
A:正确
B:错误,可以没有最小值
C:错误,可以没有起始值和步长
D:错误

你可能感兴趣的:(1z0-051)