﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / Working with Oracle  / After Insert trigger / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 11:21:19 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: After Insert trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1412285-1044-1.aspx</link><description>You cannot update emp again from an after trigger (could cause looping). Try a before insert trigger.Ps why are you updating the whole table (status=1) for each row?</description><pubDate>Mon, 28 Jan 2013 09:50:08 GMT</pubDate><dc:creator>Jo Pattyn</dc:creator></item><item><title>After Insert trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1412285-1044-1.aspx</link><description>Hi ,I have a requirement where i have a table (EMP) with fields id, name, statusWhat i want is after each insert write the data to another table(EMP_BACKUP) and update the status of EMP table to 1.I have written a trigger------------------------------------------------------------------create or replacetrigger fetched_records_triggerafter insert on EMP for each rowDECLARE--v_username varchar2(10);BEGINinsert into EMP_BACKUP values (:new.id , :new.COUNT_PER_FETCH, :new.SUCCESS_COUNT, :new.FAILURE_COUNT, :new.FAILURE_DES, :new.STATUS);update EMP set status=1;END;Am able to insert the data into EMP_BACKUP table but cannot update the status column in EMP table to 1Am getting the below errror-------------------------------SQL Error: ORA-04091: table KCBUSER.FETCHED_RECORDS is mutating, trigger/function may not see itORA-06512: at "KCBUSER.FETCHED_RECORDS_TRIGGER", line 6ORA-04088: error during execution of trigger 'KCBUSER.FETCHED_RECORDS_TRIGGER'04091. 00000 - "table %s.%s is mutating, trigger/function may not see it"*Cause: A trigger (or a user defined plsql function that is referenced inthis statement) attempted to look at (or modify) a table that wasin the middle of being modified by the statement which fired it.*Action: Rewrite the trigger (or function) so it does not read that table.</description><pubDate>Mon, 28 Jan 2013 02:54:06 GMT</pubDate><dc:creator>rajasekhar.cn</dc:creator></item></channel></rss>