Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to implement a circular buffer in a table
On Wed, 15 Aug 2001 22:44:33 -0400, "Stephen T. Parfitt"
<steve.parfitt_at_sympatico.ca> wrote:
>Create a SEQUENCE with a MAXVALUE and the CYCLE option ... then use this
>sequence as the primary key. Presumably, you will need a bit of logic
>to do INSERTs on the first cycle and UPDATEs thereafter when the
>circular buffer is overwriting itself - or else initialize the buffer
>with dummy values beforehand.
>
Good idea, the sequence.
And write the logic in a PL/SQL package exposing only an INSERT and a
SELECT methods. Rollback to the begin of buffer can be achieved by a
package global boolean that gets reset once EOF is reached. Works for
me...
Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam
Received on Thu Aug 16 2001 - 07:51:17 CDT