Plsql trigger inserting deleting updating

28-Oct-2017 23:15

Because the trigger uses the clause, it might be executed multiple times, such as when updating or deleting multiple rows.

You might omit this clause if you just want to record the fact that the operation occurred, but not examine the data for each row.

; select * from employee01; -------- ---------- ----------- ------------------- -------- ------- | emp_id | emp_name | city | designation | salary | perks | -------- ---------- ----------- ------------------- -------- ------- | 1 | david | delhi | manager | 12000 | 855 | | 2 | shaha | mumbai | assistant manager | 13000 | 853 | | 3 | sha | puna | scales manager | 11000 | 850 | | 4 | jack | bangalore | designer | 14000 | 854 | | 5 | james | mangalore | web designer | 15000 | 1124 | -------- ---------- ----------- ------------------- -------- ------- 5 rows in set (0.00 sec) sql select * from employee01; -------- ---------- ----------- ------------------- -------- ------- | emp_id | emp_name | city | designation | salary | perks | -------- ---------- ----------- ------------------- -------- ------- | 1 | david | delhi | manager | 11600 | 855 | | 2 | shaha | mumbai | assistant manager | 12600 | 853 | | 3 | sha | pune | scales manager | 10600 | 850 | | 4 | jack | bangalore | designer | 13600 | 854 | | 5 | james | mangalore | web designer | 14600 | 1124 | | 6 | mike | chennai | developer | 15100 | 840 | -------- ---------- ----------- ------------------- -------- ------- 6 rows in set (0.00 sec) In the above example, before insert trigger will fire the condition before inserting a record inside the table or on the table, and update operation is performed on the column salary(Set Salary=Salary-400 where perks select * from employee01; -------- ---------- ----------- ------------------- -------- ------- | emp_id | emp_name | city | designation | salary | perks | -------- ---------- ----------- ------------------- -------- ------- | 1 | david | delhi | manager | 12000 | 855 | | 2 | shaha | mumbai | assistant manager | 13000 | 853 | | 3 | sha | puna | scales manager | 11000 | 850 | | 4 | jack | bangalore | designer | 14000 | 854 | | 5 | james | mangalore | web designer | 15000 | 1124 | | 6 | mike | chennai | develpoer | 15500 | 840 | -------- ---------- ----------- ------------------- -------- ------- 6 rows in set (0.00 sec) sql CREATE TRIGGER updtrigger BEFORE UPDATE ON Employee01 FOR EACH ROW BEGIN IF NEW. i.e., after creating the student_update table it will fire on the student_log2 table and all the values will be displayed on the student_log2 table which was inserted in student_table02.

A trigger is fired based on a triggering statement, which specifies: statement might include a list of columns. Deptno) AS Amp_list_ Emplist FROM Dept_tab d; The statement level triggers are useful for performing validation checks for the entire statement.

This statement can be used with any interactive tool, such as SQL*Plus or Enterprise Manager.

When using an interactive tool, a single slash (/) on the last line is necessary to activate the 0) DECLARE sal_diff number; BEGIN sal_diff := :- :old.sal; dbms_output.put('Old salary: ' :old.sal); dbms_output.put(' New salary: '