declare n number; begin select max(lov_id) + 1 into n from dbcgo_lov ; DBMS_OUTPUT.Put_Line ('next lov id: ' || n); begin EXECUTE IMMEDIATE ('drop sequence seq_lov'); exception when others then null; end; EXECUTE IMMEDIATE ('create sequence seq_lov start with ' || n); end; / show errors;