Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORDER BY vs MIN to implement FIFO
D Rolfe <dwrolfeFRUITBAT_at_orindasoft.com> wrote:
>
>
>Saeed wrote:
>
>> A table holds data of jobs. Some are waiting to be actioned. A query is
>> required to pull out the the one that has been in this stae the longest.
>> The two options are:
>>
>> SELECT job_id FROM jobs WHERE status = 'W' ORDER BY job_id
>>
>
>How do you know that job_id's are handed out in sequence? If they aren't
>the above query won't work 100% of the time. Don't think that using a
>SEQUENCE guarantees that the numbers will be sequential- unique yes,
>sequential not always if you have multiple users.
>
>David Rolfe
>Orinda Software
>Dublin, Ireland
A sequence will be , by definition,sequential ( unless explicitly altered or created with a CYCLE and MIN/MAX parameters ,
in which case the uniqueness would also be lost) but it may not be an uninterrupted sequence however since rollbacks, etc
will leave gaps in the sequence-
( it could be 1,3,7, 21,45 - but not 1,3,2,4,17,6,28)
Received on Fri Jun 25 2004 - 08:46:11 CDT
![]() |
![]() |