oracle sequence 争用,oracle中sequence使用的限制

ORA-02287: 此处不允许序号

带有distinct操作符的select语句不能使用

SQL> select distinct a.*,test_seq.currval from test_v a ;

select distinct a.*,test_seq.currval from test_v a

ORA-02287: 此处不允许序号

有group by,order by操作的select语句不能使用

SQL>  select  test_jy.*,test_seq.currval from test_jy group by test_jy.test_id;

select  test_jy.*,test_seq.currval from test_jy group by test_jy.test_id

ORA-02287: 此处不允许序号

SQL>  select  test_jy.*,test_seq.currval from test_jy order by test_jy.test_id;

select  test_jy.*,test_seq.currval from test_jy order by test_jy.test_id

ORA-02287: 此处不允许序号

有UNION, INTERSECT, MINUS操作符的语句不能使用

SQL> select  test_jy.*,test_seq.currval from test_jy where test_id=1

2  union

3  select  test_jy.*,test_seq.currval from test_jy where test_id=2;

select  test_jy.*,test_seq.currval from test_jy where test_id=1

union

select  test_jy.*,test_seq.currval from test_jy where test_id=2

ORA-02287: 此处不允许序号

SQL> select  test_jy.*,test_seq.currval from test_jy where test_id=1

2  intersect

3  select  test_jy.*,test_seq.currval from test_jy where test_id=2;

select  test_jy.*,test_seq.currval from test_jy where test_id=1

intersect

select  test_jy.*,test_seq.currval from test_jy where test_id=2

ORA-02287: 此处不允许序号

SQL> select  test_jy.*,test_seq.currval from test_jy where test_id=1

2  minus

3  select  test_jy.*,test_seq.currval from test_jy where test_id=2;

select  test_jy.*,test_seq.currval from test_jy where test_id=1

minus

select  test_jy.*,test_seq.currval from test_jy where test_id=2

ORA-02287: 此处不允许序号

在select语句中的where子句中

SQL> select  test_jy.* from test_jy where test_idselect  test_jy.* from test_jy where test_idORA-02287: 此处不允许序号

在create table或alter table语句的中default值是不能使用sequence

SQL> alter table test_jy modify test_id number(20) default test_seq.currval;

alter table test_jy modify test_id number(20) default test_seq.currval

ORA-00984: 列在此处不允许

还有就在check约束中不能使用

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26015009/viewspace-751448/,如需转载,请注明出处,否则将追究法律责任。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值