CREATE OR REPLACE Procedure Auto_Reset_Sequence(seqName In Varchar2) Is
n Number;
Begin
Begin
Execute Immediate 'select ' || seqName || '.nextval from dual'
Into n;
Execute Immediate 'alter sequence ' || seqName || ' increment by -' || n;
Execute Immediate 'select ' || seqName || '.nextval from dual'
Into n;
Execute Immediate 'alter sequence ' || seqName || ' increment by 1 ';
End;
End;