Plsql trigger inserting deleting updating
We can recompile a view using the Alter view statement, but oracle automatically recompiles the view once it is accessed.On recompiling the dependent objects become invalid.PUT_LINE('empid successfully updated into emp_backup table'); END; The above trigger named ’emp_after_update’ will be initiated whenever ’empid’ column in ’emp’ table gets updated.Now before updating ’empid’ column in ’emp’ table see the ’emp’ and ’emp_backup’ table records.4)If you ROLLBACK the transaction before committing to the database, the data inserted to the table is also rolled back.There are two types of triggers based on the which level it is triggered.
if inserting then INSERT INTO SRC_TBL (CFG_NAME, CFG_VALUE) VALUES(: NEW. CFG_VALUE); elsif updating then UPDATE SRC_TBL SET CFG_VALUE = : NEW.
We can use Create or Replace option to create views instead of dropping the view and recreating it, as with this option the privileges granted on the view are preserved, but the dependent stored programs and view become invalid.
The view will become invalid whenever the base table is altered.
Since you can't list more than one table in the Oracle UPDATE statement, you can use the Oracle EXISTS clause.
A database trigger is a stored procedure that automatically executes whenever an event occurs. Oracle initiates an ‘AFTER INSERT’ trigger after an insert event has been occurred and an ‘AFTER UPDATE’ trigger after an update event has been occurred.