oracle中创建sequence指定起始值

时间:2022-11-02 12:38:02

oracle中创建sequence指定起始值

DECLARE
V_Area_Id NUMBER;
BEGIN
SELECT MAX(T.Area_Id)+10 INTO V_Area_Id FROM T_PM_TankArea T;
if V_Area_Id is null THEN select 1 into V_Area_Id from dual;
END IF; EXECUTE IMMEDIATE
'create sequence S_PM_TankArea
minvalue 1
maxvalue 9999999999999999999999999999
start with ' || V_Area_Id
|| 'increment by 1
nocache';
end;
/