ITPub博客

首页 > 数据库 > Oracle > 记一次ora-02287 sequence number not allowed错误

记一次ora-02287 sequence number not allowed错误

原创 Oracle 作者:qqmengxue 时间:2010-11-09 17:55:39 0 删除 编辑

今天项目里报说一个存储过程总报错,询问修改轨迹后是在以前的insert ... select里面加入了sequence,而且sequence是放在group by的子查询里面了,最后将sequence引入到了外层没有group by的查询里面就OK了。

[@more@]

下面为模拟错误:

create table tests(
Id INT,
Name varchar2(10)

);

create sequence test_s
minvalue 1
maxvalue 9999999999999999999999
start with 1
increment by 1
nocache;


SQL> insert into tests select test_s.Nextval,1 from dual group by 1
2 ;

insert into tests select test_s.Nextval,1 from dual group by 1

ORA-02287: 此处不允许序号

SQL> insert into tests select test_s.Nextval,a.* from (select 1 from dual group by 1) a

1 row inserted

SQL>

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

请登录后发表评论 登录
全部评论

注册时间:2009-03-26

  • 博文量
    169
  • 访问量
    589153