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開始。)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章