Subject | Re: [ib-support] conversion error from string |
---|---|
Author | Carsten Schäfer |
Post date | 2002-06-24T10:29:42Z |
I've an multiuser enviroment,
but my other tables (where the error not happens) are used much more than this table.
And when this error happens for one time i can do no insert to this table till my app is closed and started again.
Another question:
Both, an before-insert or an after insert trigger should be in one transaction with the insert-statement or not ?
gruse
Carsten
but my other tables (where the error not happens) are used much more than this table.
And when this error happens for one time i can do no insert to this table till my app is closed and started again.
Another question:
Both, an before-insert or an after insert trigger should be in one transaction with the insert-statement or not ?
gruse
Carsten
----- Original Message -----
From: "Svein Erling Tysvær" <svein.erling.tysvaer@...>
To: <ib-support@yahoogroups.com>
Sent: Monday, June 24, 2002 12:25 PM
Subject: Re: [ib-support] conversion error from string
> Hi Carsten!
>
> >I have an after insert trigger like this:
> >BEGIN
> >update t_rechnung set id_rechnung = (select max(id_rechnung) + 1 FROM
> >t_rechnung) where
> >NEW.id_rechnung = id_rechnung;
> >END
>
> I know nothing about your error message, but using this kind of code for
> creating a primary key or any unique value in a multiuser environment is
> asking for trouble! My guess is that the error occurs when two users
> "simultaneously" (one transaction starts before the other is committed) is
> trying to update the table. The reason you haven't seen it for other tables
> is probably because these tables are less frequently added to. Change to
> using before insert triggers which set id_rechnung to
> GEN_ID(<your_generator_name>, 1) if no value for id_rechnung is set
> explicitly.
>