sql 序列从另一个音序器中获取的值开始
sql sequence start with value taken from another sequencer
我需要删除一个音序器并创建另一个以最后一个音序器为起始值的音序器。硬编码起始值不是一种选择。
DECLARE
NxtVal INTEGER;
BEGIN
SELECT (SEQ1.NEXTVAL)+10
into NxtVal
From Dual;
execute immediate 'Create sequence SEQ2
minvalue 1
maxvalue 99999
start with || NxtVal ||
increment by 1';
END;
/
似乎有一些 '
缺失:
DECLARE
NxtVal INTEGER;
BEGIN
SELECT (SEQ1.NEXTVAL)+10
into NxtVal
From Dual;
execute immediate 'Create sequence SEQ2 '
'minvalue 1 '
'maxvalue 99999 '
'start with ' || NxtVal || -- missing '
' increment by 1';
END;
/
我需要删除一个音序器并创建另一个以最后一个音序器为起始值的音序器。硬编码起始值不是一种选择。
DECLARE
NxtVal INTEGER;
BEGIN
SELECT (SEQ1.NEXTVAL)+10
into NxtVal
From Dual;
execute immediate 'Create sequence SEQ2
minvalue 1
maxvalue 99999
start with || NxtVal ||
increment by 1';
END;
/
似乎有一些 '
缺失:
DECLARE
NxtVal INTEGER;
BEGIN
SELECT (SEQ1.NEXTVAL)+10
into NxtVal
From Dual;
execute immediate 'Create sequence SEQ2 '
'minvalue 1 '
'maxvalue 99999 '
'start with ' || NxtVal || -- missing '
' increment by 1';
END;
/