Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Importance of cache in sequence & Nextval query in SQL

MITEEEMay 13 2014 — edited May 13 2014

Hi All,

In order to have a unique number for all the employees in emp table i have created a sequence by adding a column ID in emp table and i created a sequence. after generating the sequence i thought of knowing the next value that will be generating in the sequence. So i have written the below query,

select id.nextval from emp1;

i got the output from 15 to 28. In this case when i first generated the sequence the sequence got generated upto 14. But, when i try to access the next val in the sequence it should have given me only 15 as the next value in sequence. Instead it list values from 15 to 28.

Also, in need to know what is the use of cache function while creating the sequence.

Thanks & Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2014
Added on May 13 2014
8 comments
2,918 views