Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORDER BY vs MIN to implement FIFO

Re: ORDER BY vs MIN to implement FIFO

From: Turkbear <john.g_at_dot.spamfree.com>
Date: Fri, 25 Jun 2004 08:46:11 -0500
Message-ID: <elaod0l5qb2b4mcb4fpaictg5eb9av1454@4ax.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US