Subject Re: [ib-support] Sequential running no using trigger and generator
Author junior
Hi Svein!

Thanks for your alternative, it's definitely much better crafted than my
quick (and may be unreliable) solution.

Best wishes,

----- Original Message -----
From: "Svein Erling Tysvær" <svein.erling.tysvaer@...>
To: <>
Sent: Thursday, August 16, 2001 4:34 PM
Subject: Re: [ib-support] Sequential running no using trigger and generator

> Hi Junior!
> >Which way is better, any unwanted side effects? Or is there better ideas?
> Don't know if my suggestion is any better, but it is at least different:
> First of all, do not make this sequential number your primary key (PK)!
> a separate, normal generator to populate the PK. Then make a unique index
> on your sequential field. Get its value from a separate table (i.e. make
> one separate table with one PK field populated from a generator (this
> should have a descending index (or store the negative PK value)) and a
> field for current_sequential_value ) by something like SELECT
> current_sequential_value FROM my_sequential_table WHERE PK = (SELECT
> MAX(PK) FROM my_sequential_table), try to insert your record and post it
> with this value+1 in your sequential field. If it fails due to a violation
> of unique constraint on your sequential field, just increase the value
> until you succeed. Then insert a new record to my_sequential_table with
> current_sequential_value you chose that succeeded.
> HTH,
> Set
> To unsubscribe from this group, send an email to:
> Your use of Yahoo! Groups is subject to