I am maintaining a database using Oracle 10g and I would like to have a sequence that starts from 1 and increments by 1 with each additional row.
I have created the following statement in order to achieve this:
CREATE SEQUENCE PATIENTS_SEQ START WITH 1 INCREMENT BY 1 NOMINVALUE NOCACHE NOCYCLE;
However, upon inserting the first entry into the table with value (PATIENTS_SEQ.NEXTVAL), the count starts at 2 instead of 1. If I modify my sequence to start with 0, then I get an error that the start with value cannot be less than the minvalue. Can anyone help troubleshoot how to get my count to start properly from 1?
Simply set the minvalue to 0 as well:
CREATE SEQUENCE PATIENTS_SEQ
START WITH 0
INCREMENT BY 1
MINVALUE 0
NOCACHE
NOCYCLE;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With