如何在Oracle中重置序列?在……里面PostgreSQL我可以做这样的事:ALTER SEQUENCE serial RESTART WITH 0;有甲骨文的等价物吗?
3 回答
幕布斯6054654
TA贡献1876条经验 获得超7个赞
tkyte@TKYTE901.US.ORACLE.COM> create or replaceprocedure reset_seq( p_seq_name in varchar2 )is l_val number;begin execute immediate 'select ' || p_seq_name || '.nextval from dual' INTO l_val; execute immediate 'alter sequence ' || p_seq_name || ' increment by -' || l_val || ' minvalue 0'; execute immediate 'select ' || p_seq_name || '.nextval from dual' INTO l_val; execute immediate 'alter sequence ' || p_seq_name || ' increment by 1 minvalue 0';end;/
MMMHUHU
TA贡献1834条经验 获得超8个赞
删除序列 重造
--Drop sequenceDROP SEQUENCE MY_SEQ;-- Create sequence create sequence MY_SEQ minvalue 1maxvalue 999999999999999999999start with 1increment by 1cache 20;
添加回答
举报
0/150
提交
取消