|
However, in this case I'm not sure why a lookahead would be any better than
just reading the file and detecting when the record just read is not the
next consecutive integer after the previous read.
I'm with Joe here -- if there is a pre-existing index on the field that
needs to be tested, a HLL program loop seems like a better tool for the job
than SQL. Given a number range, you just SETLL to the start of the range.
If it is not in use, you already have the smallest missing number. Then you
just read the file by key, and the the first (or each) time the value is not
one higher than the previous read, you found another gap. Then you either
quit if you only needed the smallest number, or continue until you have
reached EOF or the high end of the number range requested.
As an Amazon Associate we earn from qualifying purchases.
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.