database-trigger

Why cannot I create triggers on objects owned by SYS?

二次信任 提交于 2019-11-26 17:24:04
问题 While trying to create a trigger named ghazal_current_bef_upd_row : create trigger ghazal_current_bef_upd_row before update on ghazal_current for each row when (new.Rating < old.Rating) begin insert into ghazal_current_audit (GhazalName,Old_Rating,New_Rating) values (:old.GhazalName,:old.Rating,:new.Rating); end; I get the following error : Error report: ORA-04089: cannot create triggers on objects owned by SYS 04089. 00000 - "cannot create triggers on objects owned by SYS" *Cause: An attempt

MySQL trigger set values for NEW row and update another in the same table

末鹿安然 提交于 2019-11-26 16:37:16
问题 I have a table that I keep track of fees for a specific item. These fees can change over time so I have two columns (startDate, endDate) with the current set of fees always having an endDate in the far future. I already have a trigger that I use to do some calculations on the new row being entered but what I also want to have happen is if I enter an item that already has an entry I want to set the previous entry's endDate to the day before the new entry's startDate and the new endDate to a

MySQL - Trigger for updating same table after insert

你说的曾经没有我的故事 提交于 2019-11-25 23:42:06
问题 Here\'s what I\'m trying to do: When there\'s a new INSERT into the table ACCOUNTS , I need to update the row in ACCOUNTS where pk = NEW.edit_on by setting status=\'E\' to denote that the particular (old) account has been edited. DELIMITER $$ DROP TRIGGER IF EXISTS `setEditStatus`$$ CREATE TRIGGER `setEditStatus` AFTER INSERT on ACCOUNTS FOR EACH ROW BEGIN update ACCOUNTS set status=\'E\' where ACCOUNTS.pk = NEW.edit_on ; END$$ DELIMITER ; The requirement is NOT that I manipulate the newly