× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Folks:

I'm having a bit of a struggle understanding the SQL Sequence business cases.

I understand the conceptual idea behind SQL Sequences ... but the behavior I'm observing in testing is kind of baffling me.

In interactive SQL (no commitment control), I created a SQL sequence in a schema starting at 1 with a cache value of 10.

I then run the following statement:
select (next value for TESTSEQ1) from sysibm/sysdummy1

I get a result of '1'.

If I run the same SQL statement again, I get the result '2'.

However, if I start interactive SQL in another job, and run the same statement I get a value of '11'.

From what I understand about SQL Sequences, you're supposed to use it to get a sequential number from SQL on an select, insert, or update statement.

What I'm not understanding is why the 'sequential' number isn't so sequential ... and very gappy.

I do know that I could use the no cache option to disable caching ... but I'm just trying to understand the business cases for the sequence concept.

Thanks!

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.