I am developing a JSP application in JSP with Oracle 11gr2. I have created a sequence:
CREATE SEQUENCE Movie_SEQ INCREMENT BY 1 MAXVALUE 99999 MINVALUE 1 CACHE 20;
Inserting data from sql developer seems fine: the primary key takes values in order 1,2,3,etc. But when I try to insert row from JSP calling a function:
add_m(Movie_SEQ.NEXTVAL, ....)
which executes a statement like
insert into table_name values(Movie_SEQ.NEXTVAL, ...)
the sequence generates numbers like : 1,2,22,23,30,...not in order. Why?? Could you please explain me what is wrong.
It is because cache size. Oracle caches count of nextval for fast access of each transaction.