In article <40D96C94.5040005@bvx.cz>,
Milos Prudek <prudek@bvx.cz> 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.