Home > database >  Can't to the updated data after the trigger to update tables
Can't to the updated data after the trigger to update tables

Time:10-08

Your bosses, consult the trigger, I now have two tables dm_delivbill and dm_verifydetail, I think there is increase in dm_verifydetail table rows or modify the selected by its primary key cdelivbill_hid ts after the maximum field, and to filter out the data of the Dr=1 revision table dm_delivbill corresponding field vdef15='0', Dr=0 modify tables dm_delivbill corresponding field vdef15='1'. The dm_delivbill and dm_verifydetail cdelivbill_hid field is the same as link condition,
But after I write the following statement, executed, but every time I modify dm_verifydetail or increase dm_verifydetail table, are based on changes in front of the table for the rules to change, for instance, I add a line in the morning, afternoon again add a line of this line will update in the morning, is that I have a problem statement is written?
The create or replace the trigger yfyffp
After the INSERT OR update of Dr On dm_verifydetail
FOR EACH ROW
Declare
PRAGMA AUTONOMOUS_TRANSACTION;
The begin
The update dm_delivbill
The set vdef15='1'
Where cdelivbill_hid in (SELECT a.c delivbill_hid
The FROM dm_verifydetail a
WHERE NOT the EXISTS (SELECT 1
The FROM dm_verifydetail b
WHERE b.t s & gt; A.t s
Group by cdelivbill_hid)
And a. d. r=0);

COMMIT;
The update dm_delivbill
The set vdef15='0'
Where cdelivbill_hid in (SELECT a.c delivbill_hid
The FROM dm_verifydetail a
WHERE NOT the EXISTS (SELECT 1
The FROM dm_verifydetail b
WHERE b.t s & gt; A.t s
Group by cdelivbill_hid)
And a. d. r=1);

COMMIT;
end;

CodePudding user response:

As far as possible or absolutely avoid using a trigger

CodePudding user response:

After the INSERT OR update of Dr On dm_verifydetail
- & gt;
After the INSERT OR update on dm_verifydetail
  • Related