我想做个子增序列,但是不想修改表中的原来数据,而是取得表中的最大值如:100,然后用101给序列赋值,
SQL> declare
2 temp number(6);
3 begin
4 select max(ProvinceID) into temp from provinceinfo;
5
6 CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH (temp+1) MAXVALUE 99999999999999999
99999999999 NOCYCLE CACHE 20 NOORDER;
7
8
9 end;
10 sho err
11 /错误如下,请高手帮忙
CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH (temp+1) MAXVALUE 9999999999999999999999
*
ERROR λÓÚµÚ 6 ÐÐ:
PLS-00103:出现符号"create "在需要下列之一时
begincasedeclareend
exceptionexitforgotoifloopmodnullpragmaraisereturnselect
updatewhilewith<an identifier>
<a double-quoted delimited-identifier><a bind variable><<
closecurrentdeletefetchlockinsertopenrollbacksavepointsetsql
executecommitforallmerge<a single-quoted SQL string>pipe
SQL> declare
2 temp number(6);
3 begin
4 select max(ProvinceID) into temp from provinceinfo;
5
6 CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH (temp+1) MAXVALUE 99999999999999999
99999999999 NOCYCLE CACHE 20 NOORDER;
7
8
9 end;
10 sho err
11 /错误如下,请高手帮忙
CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH (temp+1) MAXVALUE 9999999999999999999999
*
ERROR λÓÚµÚ 6 ÐÐ:
PLS-00103:出现符号"create "在需要下列之一时
begincasedeclareend
exceptionexitforgotoifloopmodnullpragmaraisereturnselect
updatewhilewith<an identifier>
<a double-quoted delimited-identifier><a bind variable><<
closecurrentdeletefetchlockinsertopenrollbacksavepointsetsql
executecommitforallmerge<a single-quoted SQL string>pipe
2 temp number(6);
str long;
3 begin
4 select max(ProvinceID) into temp from provinceinfo;
5
6 Str = 'CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH ('||temp+1\\') MAXVALUE 99999999999999999'
99999999999 NOCYCLE CACHE 20 NOORDER;
7 execute immediate Str ; 8
9 end;
2 temp number(6);
str long;
3 begin
4 select max(ProvinceID) into temp from provinceinfo;
5
6 Str = 'CREATE SEQUENCE PROVINCEINFO_SEQ INCREMENT BY 1 START WITH ('||temp+1\\') MAXVALUE 99999999999999999
99999999999 NOCYCLE CACHE 20 NOORDER';
7 execute immediate Str ; 8
9 end;