Описание
(Нет описания для триггера ILT$ITDELETE)
Определение
CREATE TRIGGER ILT$ITDELETE FOR IT
ACTIVE AFTER DELETE POSITION 1000
as
declare variable TABLEOPERATIONID integer;
declare variable TABLEID integer;
declare variable FIELDID integer;
declare variable FIELDNAME char(31);
declare variable PARTYIDID integer;
declare variable REGDATEID integer;
declare variable OPERATIONIDID integer;
declare variable INVOICEIDID integer;
declare variable GROSSID integer;
declare variable TAREID integer;
declare variable NETID integer;
declare variable OWNERIDID integer;
declare variable PROVIDERIDID integer;
declare variable SAMPLERQUALITYIDID integer;
declare variable LABQUALITYIDID integer;
declare variable SILAGEIDID integer;
declare variable ROUTEIDID integer;
declare variable STORAGEIDID integer;
declare variable STATEID integer;
begin
if (old.STATE <> -999) then begin
TABLEOPERATIONID = gen_id(GEN_ILT$TABLEOPERATION_ID,1);
select TABLEID
from ILT$TABLES
where (ILT$TABLES.TABLENAME = 'IT')
into :TABLEID;
insert into ILT$TABLEOPERATION (TABLEOPERATIONID, TABLEID, RECORDID, OPERATIONID)
values (:TABLEOPERATIONID, :TABLEID, old.INVENTORYID, 3);
for
select FIELDID, FIELDNAME
from ILT$FIELDS
where (TABLEID = :TABLEID)
into :FIELDID, :FIELDNAME
do begin
if (:FIELDNAME = 'PARTYID')
then PARTYIDID = :FIELDID;
else
if (:FIELDNAME = 'REGDATE') then
REGDATEID = :FIELDID;
else
if (:FIELDNAME = 'OPERATIONID') then
OPERATIONIDID = :FIELDID;
else
if (:FIELDNAME = 'INVOICEID') then
INVOICEIDID = :FIELDID;
else
if (:FIELDNAME = 'GROSS') then
GROSSID = :FIELDID;
else
if (:FIELDNAME = 'TARE') then
TAREID = :FIELDID;
else
if (:FIELDNAME = 'NET') then
NETID = :FIELDID;
else
if (:FIELDNAME = 'OWNERID') then
OWNERIDID = :FIELDID;
else
if (:FIELDNAME = 'PROVIDERID') then
PROVIDERIDID = :FIELDID;
else
if (:FIELDNAME = 'SAMPLERQUALITYID') then
SAMPLERQUALITYIDID = :FIELDID;
else
if (:FIELDNAME = 'LABQUALITYID') then
LABQUALITYIDID = :FIELDID;
else
if (:FIELDNAME = 'SILAGEID') then
SILAGEIDID = :FIELDID;
else
if (:FIELDNAME = 'ROUTEID') then
ROUTEIDID = :FIELDID;
else
if (:FIELDNAME = 'STORAGEID') then
STORAGEIDID = :FIELDID;
else
if (:FIELDNAME = 'STATE') then
STATEID = :FIELDID;
end
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :PARTYIDid, old.PARTYID);
insert into ilt$fielddate (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :REGDATEid, old.REGDATE);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :OPERATIONIDid, old.OPERATIONID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :INVOICEIDid, old.INVOICEID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :GROSSid, old.GROSS);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :TAREid, old.TARE);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :NETid, old.NET);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :OWNERIDid, old.OWNERID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :PROVIDERIDid, old.PROVIDERID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :SAMPLERQUALITYIDid, old.SAMPLERQUALITYID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :LABQUALITYIDid, old.LABQUALITYID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :SILAGEIDid, old.SILAGEID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :ROUTEIDid, old.ROUTEID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :STORAGEIDid, old.STORAGEID);
insert into ILT$FIELDINTEGER (TABLEOPERATIONID, FIELDID, FIELDVALUE)
values (:TABLEOPERATIONID, :STATEID, old.STATE);
end
end