OCP考题解析_007: 序列

sequence的设计可保唯一、但无法做到连续
实例当了,sequence断号、事务回滚了,sequence断号、并发访问,sequence可能断号......

调用seq_name.currval, 返回的是序列在此会话中的调用seq_name.currval之前的最后一次调用seq_name.nextval的返回值
因此单独调用seq_name.currval时、必须确保在此之前该会话中有调用过seq_name.nextval(似乎有初始化作用)
若seq_name.currval、seq_name.nextval 在同一个SQL语句中出现、则先执行seq_name.nextval,再执行seq_name.currval

因此二者的返回值应是相等的


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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值