当前位置:操作系统 > Unix/Linux >>

OCP考题解析_007: 序列

OCP考题解析_007: 序列
 
 sequence的设计可保唯一、但无法做到连续
     实例当了,sequence断号、事务回滚了,sequence断号、并发访问,sequence可能断号......
       www.zzzyk.com  
     调用seq_name.currval, 返回的是序列在此会话中的调用seq_name.currval之前的最后一次调用seq_name.nextval的返回值
     因此单独调用seq_name.currval时、必须确保在此之前该会话中有调用过seq_name.nextval(似乎有初始化作用)
  www.zzzyk.com  
     若seq_name.currval、seq_name.nextval 在同一个SQL语句中出现、则先执行seq_name.nextval,再执行seq_name.currval
     因此二者的返回值应是相等的
 
[sql] 
Q: 23 Which two statements about sequences are true? (Choose two.)  
  
A. You use a NEXTVAL pseudo column to look at the next possible value that would be generated from a   
sequence, without actually retrieving the value.   
  
B. You use a CURRVAL pseudo column to look at the current value just generated from a sequence, without   
affecting the further values to be generated from the sequence.   
  
C. You use a NEXTVAL pseudo column to obtain the next possible value from a sequence by actually   
retrieving the value from the sequence.   
  
D. You use a CURRVAL pseudo column to generate a value from a sequence that would be used for a   
specified database column.   
  
E. If a sequence starting from a value 100 and incremented by 1 is used by more than one application, then all   
of these applications could have a value of 105 assigned to their column whose value is being generated by the sequence.   
  
F. You use a REUSE clause when creating a sequence to restart the sequence once it generates the maximum   
value defined for the sequence.   
  
Answer: B, C  
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,