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

Home -> Community -> Usenet -> c.d.o.server -> Re: Sequences

Re: Sequences

From: Mark G <markag_at_wonderstats.com>
Date: 2000/08/10
Message-ID: <F4155D9F9AA4D111B9990020AFBA52D53E9F12@class06.ip061.sfi-software.com>#1/1

Just an idea but...

Let's say you have a master table that generates a primary key for each forum record.

MAINT_FORUM


MAINT_FORUM_ID    NUMBER(10) -- sequenced primary key
FORUM_DESCRIPTION VARCHAR2(50)
FORUM_SEQUENCE  VARCHAR2(30)-- sequence name associated with this forum
.
.

When the forum is created, create a sequence dynamically that you associate with the forum [FORUM_SEQUENCE] and use a naming convention like SEQ_FORUM_[MAINT_FORUM_ID]
using dynamic sql
so if you create forum # 100, the sequence you create associated with that would be SEQ_FORUM_100 and you would write that string into the MAINT_FORUM.FORUM_SEQUENCE.
the downside is you need to look up the FORUM_SEQUENCE string every time you need to create a new message for that forum. And, this would all have to be done with dynamic sql.

There may be a better way to do it but that's a quick idea...

Good Luck

"M2" <mmortonallen_at_csu.edu.au> wrote in message news:8mt39i$mr2$1_at_nnrp1.deja.com...
> Hi All,
> I have a question about sequences. I am currently writing an Oracle
> powered online forums system. Messages within this system are uniquely
> identified by an incremental count within each forum. What I am after
> is a way to create a sequence that can start from 1 for each forum
> rather than right across all forums. Does anyone know an easy way to do
> this?
>
> Matt.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Aug 10 2000 - 00:00:00 CDT

Original text of this message

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