I created a trigger that does: When removing a table value, it performs an update on the same table as the event occurs. That means I need a temporary table to perform this trigger?
Error in SQL Developer (Oracle):
Cause: A trigger (or a user defined plsql function That Is referenced in this statement) attempted to look at (or modify) a table que was in the middle of being modified by the statement Which fired it.
Action: Rewrite the trigger (or function) so it does not read que table.
create or replace
TRIGGER "trigger_name"
AFTER DELETE ON table1 FOR EACH ROW
BEGIN
MERGE INTO table1 t
USING ( SELECT rowid rid, row_number() OVER (PARTITION BY column_pearson order by column_age) rn FROM table1) u
ON ( t.rowid = u.rid )
WHEN MATCHED THEN UPDATE SET t.column2 = u.rn;
END;
-- with compound trigger -same error
create or replace
trigger "name_trigger"
for delete on table1
COMPOUND TRIGGER
AFTER STATEMENT IS
BEGIN
MERGE INTO table1
USING ( SELECT rowid rid, row_number() OVER (PARTITION BY column_pearson order by column_age rn FROM table1) u
ON ( t.rowid = u.rid )
WHEN MATCHED THEN UPDATE SET t.column2 = u.rn;
END AFTER STATEMENT
END name_trigger
http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm