MySQL Forums
Forum List  »  Triggers

Re: INSERT INTO on AFTER UPDATE trigger
Posted by: JK Heydt
Date: June 26, 2020 02:41PM

Thank you Peter,

Here is what I tried. I get red X's on the end if; and END rows at the bottom. No explanation as to why.

CREATE DEFINER = CURRENT_USER TRIGGER `hto_demo`.`field_AFTER_UPDATE` AFTER UPDATE ON `field` FOR EACH ROW
BEGIN
if new.FieldID<>old.FieldID then

INSERT INTO row_change
(RowID, TableCd, FieldID, ChangeDateTime, RecordCreatedBit , DataBefore,DataAfter,UserID)
select
new.RowID
,'FLD'
,'110'
,Getdate()
,0
,old.FieldID
,new.FieldID
,system_user()

end if;

END

Options: ReplyQuote


Subject
Views
Written By
Posted
1317
June 26, 2020 06:21AM
Re: INSERT INTO on AFTER UPDATE trigger
567
June 26, 2020 02:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.