Pl sql if inserting updating

Rated 4.98/5 based on 587 customer reviews

Let's create a BEFORE and AFTER statement and row level triggers for the product table.1) BEFORE UPDATE, Statement Level: This trigger will insert a record into the table 'product_check' before a sql update statement is executed, at the statement level.There are essentially two methods for adding records to a table.The first is to add one record at a time; the second is to add many records at a time.1) Create the 'product' table and 'product_price_history' table Once the above update query is executed, the trigger fires and updates the 'product_price_history' table.4)If you ROLLBACK the transaction before committing to the database, the data inserted to the table is also rolled back.The below statement shows the structure of the view 'USER_TRIGGERS' NAME Type -------------------------------------------------------- TRIGGER_NAME VARCHAR2(30) TRIGGER_TYPE VARCHAR2(16) TRIGGER_EVENT VARCHAR2(75) TABLE_OWNER VARCHAR2(30) BASE_OBJECT_TYPE VARCHAR2(16) TABLE_NAME VARCHAR2(30) COLUMN_NAME VARCHAR2(4000) REFERENCING_NAMES VARCHAR2(128) WHEN_CLAUSE VARCHAR2(4000) STATUS VARCHAR2(8) DESCRIPTION VARCHAR2(4000) ACTION_TYPE VARCHAR2(11) TRIGGER_BODY LONG This view stores information about header and body of the trigger.

When the table 'xyz' is updated, trigger B fires and will insert a row in table 'abc'.2) Statement level trigger - An event is triggered for each sql statement executed.The following hierarchy is followed when a trigger is fired. 2) Next BEFORE row level trigger fires, once for each row affected.3) Then AFTER row level trigger fires once for each affected row.This events will alternates between BEFORE and AFTER row level triggers.

Leave a Reply