﻿<?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 / SQL Server Newbies  / Trigger on insert / 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 15:19:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Trigger on insert</title><link>http://www.sqlservercentral.com/Forums/Topic1412244-1292-1.aspx</link><description>Ah, an Oracle trigger, you would of been best posting that in the "Working with Oracle" section instead as this is primarily a Microsoft SQL Server forum.Someone with Oracle experience may find this post and help you out, but I don't know Oracle, so I would recommend reading the Oracle Documentation on creating triggers.</description><pubDate>Mon, 28 Jan 2013 02:35:58 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Trigger on insert</title><link>http://www.sqlservercentral.com/Forums/Topic1412244-1292-1.aspx</link><description>Hi,I have written a trigger------------------------------------------------------------------create or replacetrigger fetched_records_triggerafter insert on EMP for each row    DECLARE      --v_username varchar2(10);    BEGIN     insert 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 in           this statement) attempted to look at (or modify) a table that was           in 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:33:03 GMT</pubDate><dc:creator>rajasekhar.cn</dc:creator></item><item><title>RE: Trigger on insert</title><link>http://www.sqlservercentral.com/Forums/Topic1412244-1292-1.aspx</link><description>How often is the table going to be inserted into?But a simple insert trigger would do the job, if the inserts are very few and far between.[code="sql"]CREATE TRIGGER ..... ON .....FOR INSERTASINSERT INTO .....SELECT .....FROMINSERTEDUPDATE ....SET ... = ....FROM ...INNER JOIN INSERTEDON ... = ...[/code]</description><pubDate>Mon, 28 Jan 2013 02:00:46 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Trigger on insert</title><link>http://www.sqlservercentral.com/Forums/Topic1412244-1292-1.aspx</link><description>Hi , I have a requirement where i have a table (EMP) with fields id, name, status What i want is after each insert write the data to another table(EMP_BACKUP) and update the status of EMP table to 1.ThanksRaj</description><pubDate>Mon, 28 Jan 2013 01:55:38 GMT</pubDate><dc:creator>rajasekhar.cn</dc:creator></item></channel></rss>