Subject | bde error caused by trigger |
---|---|
Author | Yves Glodt |
Post date | 2003-11-18T11:11:33Z |
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"
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
Any pointers?
best regards,
Yves
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"
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
Any pointers?
best regards,
Yves