In article <[EMAIL PROTECTED]>,
Milos Prudek <[EMAIL PROTECTED]> writes:

>> If your purpose in doing this is just to generate unique keys, you should
>> be using sequences instead.

> I would need 150 separate sequences, because each idsection needs its
> own, independent sequence of idthread.

What you really seem to need is a counter for each idsection.
Depending on how often you need to access the counter value, it might
be worthwile to not store the count at all and instead use a single sequence.
You can compute the counter value at SELECT time by something like

  SELECT idsection,
         ( SELECT count (*)
           FROM tbl t
           WHERE idsection = tbl.idsection
             AND id <= tbl.id
         ) AS idthread
  FROM tbl

where "id" is the single sequence.


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to