Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Queue mechanism for Oracle standard edition
Queue mechanism for Oracle standard editionThis is actually very easy. Of course you will have a table to store the rows in the queue. Let's say you had a table with a primary key, date, and other data like this:
create table test (
pk_num number,
list_date date,
list_text varchar2(4000)
)
Then you would create a view ordered by whatever column you want to base the queue on. If its the list_date, you would use this:
CREATE VIEW test_vu AS
SELECT *
FROM test
ORDER BY list_date;
Then you can find the first item in the queue using this:
SELECT *
FROM test_vu
WHERE rownum <= 1;
If you have duplicate values, then you would have to look at using the RANK() or DENSE_RANK() functions. Check Oracle documentation.
By the way, all of this will only work on 8i.
Andrew Simkovsky
OCP DBA
""ronen shachar (Kamoon IL)"" <ronens_at_il.kamoon.com> wrote in message
news:95D0D1D311EFD411B495009027D616EFFB1E_at_srv_mail1.il.kamoon.com...
Hello all,
We need a queue mechanism (transactional), but we can't use Oracle advance
queuing because we are working with oracle standard edition.
Does anyone have any idea about a lightweight PL/SQL queue.
TIA.
Ronen.
Received on Mon Apr 16 2001 - 13:13:50 CDT