每个月自动将ORACLE的SEQUENCE从1开始(非原)
如果有类似的需求,可以按照以下方式实现。
CREATE OR REPLACE PROCEDURE do_job IS
BEGIN
EXECUTE IMMEDIATE 'drop sequence Srno';
EXECUTE IMMEDIATE 'create sequence SrNo minvalue 1'||
' maxvalue 9999999'||
' start with 1'||
' increment by 1'||
' Order';
END do_job;
/
Declare
v_job BINARY_INTEGER;
begin
dbms_job.submit(v_job,'Begin do_job; end;',trunc(last_day(sysdate)+1)+(6/24),'trunc(last_day(sysdate)+1)+(6/24)');
end;
/