Updating of new row is not allowed in after trigger

Rated 4.28/5 based on 927 customer reviews

Easy enough in PL/SQL, right in a database trigger (see links at bottom of post for discussions on whether or not you should put logic like this in your database triggers): CREATE OR REPLACE TRIGGER equitable_salary_trg AFTER INSERT OR UPDATE ON employees FOR EACH ROW DECLARE l_max_allowed employees.salary%TYPE; BEGIN SELECT MIN (salary) * 25 INTO l_max_allowed FROM employees; IF l_max_allowed The solution, conceptually, is simple enough.

updating of new row is not allowed in after trigger-67

SIGNAL statement provide raise an exception explicitly.

More reliable - you don't have to worry about managing the session-persistent collection.

Less code - always a nice thing, as long as the "less code" is also understandable and easy to maintain.

UPDATE trigger and DELETE trigger can have OLD ROW transition variable.

NEW You can access new record of DML in trigger, which is to-be-inserted new record or to-be-updated new record. If you put 'TABLE' as ::= DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER | BIGINT | SMALLDECIMAL | DECIMAL | REAL | DOUBLE | VARCHAR | NVARCHAR | ALPHANUM | SHORTTEXT | VARBINARY | BLOB | CLOB | NCLOB | TEXT trigger_decl_list You can declare trigger variable or condition.

Leave a Reply