Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sequences
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