Subject Re: [firebird-support] bde error caused by trigger
Author Helen Borrie
At 12:11 PM 18/11/2003 +0100, you wrote:

>Hello,
>
>I have this trigger (thanks to heLen for her help):
>
>CREATE TRIGGER CREATE_PERS_NUMBER FOR WT_PERS
>INACTIVE BEFORE INSERT POSITION 0
>as
>DECLARE VARIABLE prefix varchar(5);
>begin
>/* if (NEW.PERS_NUMBER is null) then NEW.PERS_NUMBER =
>gen_id(gen_pers_number, 1); */
> NEW.PERS_NUMBER = gen_id(gen_pers_number, 1);
> if ((NEW.PERS_NUMBER >= 0) and (NEW.PERS_NUMBER < 10)) then
> prefix = '0000';
> if ((NEW.PERS_NUMBER >= 10) and (NEW.PERS_NUMBER < 100)) then
> prefix =
>'000';
> if ((NEW.PERS_NUMBER >= 100) and (NEW.PERS_NUMBER < 1000)) then
> prefix =
>'00';
> if ((NEW.PERS_NUMBER >= 1000) and (NEW.PERS_NUMBER < 10000)) then
> prefix
>= '0';
> NEW.PERS_NUMBER = prefix || cast(NEW.PERS_NUMBER as varchar(20));
>end
>
>
>Now when I create a new record via the application, I get tis message:
>"[10259] Couldn't perform the edit because another user changed the record"

Point 1: This trigger won't fire because you created it INACTIVE. That
means the same as "not active", "sleeping", "ignore me".

Point 2: Something unrelated is happening. A Before Insert trigger (if it
were active, which it isn't) wouldn't have any effect on an update.

>I'm not sure there is a way to work around this... The bde is a dependency
>of the appcation (it's the old 16 bit bde 2.52).
>Bde settings:
>SQLPASSTHRUMODE = SHARED NOAUTOCOMMIT
>SQLQRYMODE = SERVER

[10259] isn't a Firebird exception.

heLen