Subject | Trigger after insert question |
---|---|
Author | |
Post date | 2016-10-11T09:08:42Z |
hi
I have an installation running Firebird 2.5.6 Classic server.
On one table, I have e trigger, which is defined as this:
SET TERM ^^ ;
CREATE TRIGGER UDVALG_MASTER_WEBDANMARK FOR UDVALG_MASTER ACTIVE BEFORE INSERT POSITION 10 AS
begin
if (NEW.NAVN='WEBDK') then
begin
/*CREATE RECORD TO CONSIGOR*/
if ((NEW.DEBITORNAVN<>'') OR (NEW.DEBITORFIRMA<>'')) THEN
begin
if ((NEW.CountryCode is Null) OR (NEW.CountryCode='')) then
begin
lLand = 'DK';
If (New.DEBITORADRESSE5='Danmark') then
lLand = 'DK';
If (New.DEBITORADRESSE5='Norge') then
lLand = 'NO';
If (New.DEBITORADRESSE5='Sverige') then
lLand = 'SE';
If (New.DEBITORADRESSE5='Grønland') then
lLand = 'GL';
If (New.DEBITORADRESSE5='Færøerne') then
lLand = 'FO';
end
else
begin
if (NEW.DebitorCountryCode='') then
begin
lLand = New.COUNTRYCODE;
end
else
begin
lLand = NEW.DebitorCountryCode;
end
end
if ((New.LEVERINGSMETODEINT=2) OR
(New.LEVERINGSMETODEINT=20) OR
(New.LEVERINGSMETODEINT=32)) then
begin
lAtt = NEW.DEBITORNAVN;
end
else
begin
if (New.BUYANDCOLLECTSHOP_DELIVERY<>'') then
begin
lAtt = NEW.UDVALGNAVN;
end
else
begin
lAtt = '';
end
end
INSERT INTO WEBSHOP_POSTDK (
AFDELING_ID,
LANDEKODE,
TOMTFELT01,
HASTIGHEDS_ID,
AFSENDELSESDATO,
ORDRENR,
MODTAGERID,
NAVNELINIE1,
NAVNELINIE2,
ATT_PERSON,
ADRESSELINIE1,
ADRESSELINIE2,
POSTBOKS,
POSTNR,
BYNAVN,
VAEGT,
BEMAERKNING,
EMAIL,
PROVINS_STAT,
TLFNR,
TOMTFELT02,
TOMTFELT03,
TOMTFELT04,
TOMTFELT05,
TOMTFELT06,
TOMTFELT07,
TOMTFELT08,
TOMTFELT09,
KOLLINR,
MAXKOLLINR,
TILLAEGSYDELSE,
MODTAGERTYPE,
CVRNR,
SENR,
F59,
F60)
VALUES (
NEW.SHOPNAVN,
:lLand,
'',
'PIP',
:lD2,
NEW.BONNR,
'',
NEW.DEBITORNAVN,
'',
:lAtt,
NEW.DEBITORADRESSE,
NEW.DEBITORADRESSE1,
'',
NEW.DEBITORADRESSE3,
NEW.DEBITORADRESSE4,
'',
NEW.EKSBONTEXT,
:lEMail,
'',
NEW.UDVALGTELEFON,
'',
'',
'',
'',
'',
'',
'',
'',
'1',
'1',
'48:' || NEW.UDVALGTELEFON,
NEW.LEVERINGSMETODEINT,
'',
'',
'Indsat via 1',
NEW.PAKKESHOPID);
end
end ^^
SET TERM ; ^^
I have just addedd the above bold lines, but they do not seem to take effect (the lines regarding field F59)
At least not on one connection.
Could this be, that this connection has an open connection and maybe an already prepared INSERT ready?
And is the solution the to have the client DISCONNECT?
I have an installation running Firebird 2.5.6 Classic server.
On one table, I have e trigger, which is defined as this:
SET TERM ^^ ;
CREATE TRIGGER UDVALG_MASTER_WEBDANMARK FOR UDVALG_MASTER ACTIVE BEFORE INSERT POSITION 10 AS
begin
if (NEW.NAVN='WEBDK') then
begin
/*CREATE RECORD TO CONSIGOR*/
if ((NEW.DEBITORNAVN<>'') OR (NEW.DEBITORFIRMA<>'')) THEN
begin
if ((NEW.CountryCode is Null) OR (NEW.CountryCode='')) then
begin
lLand = 'DK';
If (New.DEBITORADRESSE5='Danmark') then
lLand = 'DK';
If (New.DEBITORADRESSE5='Norge') then
lLand = 'NO';
If (New.DEBITORADRESSE5='Sverige') then
lLand = 'SE';
If (New.DEBITORADRESSE5='Grønland') then
lLand = 'GL';
If (New.DEBITORADRESSE5='Færøerne') then
lLand = 'FO';
end
else
begin
if (NEW.DebitorCountryCode='') then
begin
lLand = New.COUNTRYCODE;
end
else
begin
lLand = NEW.DebitorCountryCode;
end
end
if ((New.LEVERINGSMETODEINT=2) OR
(New.LEVERINGSMETODEINT=20) OR
(New.LEVERINGSMETODEINT=32)) then
begin
lAtt = NEW.DEBITORNAVN;
end
else
begin
if (New.BUYANDCOLLECTSHOP_DELIVERY<>'') then
begin
lAtt = NEW.UDVALGNAVN;
end
else
begin
lAtt = '';
end
end
INSERT INTO WEBSHOP_POSTDK (
AFDELING_ID,
LANDEKODE,
TOMTFELT01,
HASTIGHEDS_ID,
AFSENDELSESDATO,
ORDRENR,
MODTAGERID,
NAVNELINIE1,
NAVNELINIE2,
ATT_PERSON,
ADRESSELINIE1,
ADRESSELINIE2,
POSTBOKS,
POSTNR,
BYNAVN,
VAEGT,
BEMAERKNING,
EMAIL,
PROVINS_STAT,
TLFNR,
TOMTFELT02,
TOMTFELT03,
TOMTFELT04,
TOMTFELT05,
TOMTFELT06,
TOMTFELT07,
TOMTFELT08,
TOMTFELT09,
KOLLINR,
MAXKOLLINR,
TILLAEGSYDELSE,
MODTAGERTYPE,
CVRNR,
SENR,
F59,
F60)
VALUES (
NEW.SHOPNAVN,
:lLand,
'',
'PIP',
:lD2,
NEW.BONNR,
'',
NEW.DEBITORNAVN,
'',
:lAtt,
NEW.DEBITORADRESSE,
NEW.DEBITORADRESSE1,
'',
NEW.DEBITORADRESSE3,
NEW.DEBITORADRESSE4,
'',
NEW.EKSBONTEXT,
:lEMail,
'',
NEW.UDVALGTELEFON,
'',
'',
'',
'',
'',
'',
'',
'',
'1',
'1',
'48:' || NEW.UDVALGTELEFON,
NEW.LEVERINGSMETODEINT,
'',
'',
'Indsat via 1',
NEW.PAKKESHOPID);
end
end ^^
SET TERM ; ^^
I have just addedd the above bold lines, but they do not seem to take effect (the lines regarding field F59)
At least not on one connection.
Could this be, that this connection has an open connection and maybe an already prepared INSERT ready?
And is the solution the to have the client DISCONNECT?