CREATE OR REPLACE PROCEDURE SEQUENCE_NEWVALUE(seqowner VARCHAR2, seqname VARCHAR2, newvalue NUMBER) AS
  ln NUMBER;
  ib NUMBER;
BEGIN
  SELECT last_number, increment_by
    INTO ln, ib
    FROM dba_sequences
   WHERE sequence_owner = upper(seqowner)
     AND sequence_name = upper(seqname);
  dbms_output.put_line('ln='||ln||' , ib='||ib||' , newvalue='||newvalue);
  dbms_output.put_line('ALTER SEQUENCE ' || seqowner || '.' || seqname ||' INCREMENT BY ' || (newvalue - ln));
  dbms_output.put_line('SELECT '         || seqowner || '.' || seqname ||'.NEXTVAL FROM DUAL');
  dbms_output.put_line('ALTER SEQUENCE ' || seqowner || '.' || seqname || ' INCREMENT BY ' || ib);
  EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seqowner || '.' || seqname ||' INCREMENT BY ' || (newvalue - ln);
  EXECUTE IMMEDIATE 'SELECT '         || seqowner || '.' || seqname ||'.NEXTVAL FROM DUAL' INTO ln;
  EXECUTE IMMEDIATE 'ALTER SEQUENCE ' || seqowner || '.' || seqname || ' INCREMENT BY ' || ib;
END;
/
