If I have a table in which the primary key is data_type number(10,0)
Is it correct to define my sequence like this so it will be stored as my primary key?
create sequence seq_libros
start with 1
increment by 1
maxvalue 99999
minvalue 1;
If I have a table in which the primary key is data_type number(10,0)
Is it correct to define my sequence like this so it will be stored as my primary key?
create sequence seq_libros
start with 1
increment by 1
maxvalue 99999
minvalue 1;
The instruction to create the sequence is correct, however it will only grow up to the number 99999 and your column accepts up to 10 digits because the maximum number accepted by the column would be 9999999999.
Another thing, you have to somehow consume the sequence and assign to your primary key.
Option 1: Query the following value and assign to the record before creating it
Option 2: Create a trigger that runs after the insert and queries the sequence.
Greetings
Israel Ramos