Hi experts,
I'm using the following code to reset a sequence and for test purposes I do a select of the next.val.
When executing I get the following error :
select seq_check_types.nextval from dual
ORA-08004: sequence SEQ_CHECK_TYPES.NEXTVAL goes below MINVALUE and cannot be instantiated
Does anybody got an idea how to solve this? i'm new to Oracle and i'm not familiar with it.
CREATE OR REPLACE PROCEDURE RESET_SEQUENCE (
seq_name IN VARCHAR2, startvalue IN PLS_INTEGER, incrementvalue IN PLS_INTEGER) IS
BEGIN
EXECUTE IMMEDIATE 'DROP SEQUENCE ' ||seq_name;
EXECUTE IMMEDIATE 'CREATE SEQUENCE ' ||seq_name|| 'START WITH' ||startvalue|| 'INCREMENT BY' || incrementvalue || 'NOMAXVALUE';
END RESET_SEQUENCE;
/
DELETE FROM check_types;
RESET_SEQUENCE(seq_check_types,1,1);
select seq_check_types.nextval from dual;
Open in new window
Use the syntax below:
ALTER SEQUENCE [schema.]sequence_name MINVALUE 1
This will solve you out.