--创建增长序列
create sequence IMES.TEST_SEQ_PALLET
minvalue 1
maxvalue 1336335
start with 1
increment by 1
nocache
cycle
order;
--测试
select IMES.TEST_SEQ_PALLET.nextval from dual;
--创建存储过程重置自增序列从1开始
IMES.TEST_SEQ_RESET_NEXT
create or replace procedure imes.TEST_SEQ_RESET_NEXT AS
n NUMBER;
Begin
--IMES.TEST_SEQ_PALLET
Begin
Execute Immediate 'alter sequence IMES.TEST_SEQ_PALLET minvalue 1';
Execute Immediate 'select IMES.TEST_SEQ_PALLET.nextval from dual'
Into n;
Execute Immediate 'alter sequence IMES.TEST_SEQ_PALLET increment by -' || n;
Execute Immediate 'select IMES.TEST_SEQ_PALLET.nextval from dual'
Into n;
--Execute Immediate 'alter sequence BCM_GLOABAL_ID minvalue 1';
Execute Immediate 'alter sequence IMES.TEST_SEQ_PALLET increment b