Mutating DB Trigger Problem

Hello all, i have a ' Mutating DB Trigger Problem' for the following Trigger :
=============================================
CREATE OR REPLACE TRIGGER ASSIUT.EMP_ATTENDANCEE_MONA
AFTER INSERT
ON ASSIUT.ACCESSLOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
V_COUNT CHAR(2);
--V_COUNT_OUT CHAR(2);
BEGIN
IF :NEW.INOUT = 'IN' THEN
    INSERT INTO EMP_ATTENDANCEE (EMP_ID, DATE_IN ,DATE_OUT ,TIME_IN ,TIME_OUT)
     VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
             TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
             NULL,
             TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),      -- TIME_IN
             NULL );      -- TIME_OUT
                 SELECT COUNT(employeeid )
                 INTO V_COUNT
                FROM ACCESSLOG
                WHERE employeeid =:NEW.employeeid
                AND LOGDATE =:NEW.LOGDATE
                AND  LOGTIME  =:NEW.LOGTIME
                AND INOUT ='IN';
                IF V_COUNT > 0 THEN
     INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
     VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
             TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
      TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
      1); -- check in
      END IF;
ELSIF :NEW.INOUT = 'OUT' THEN
    UPDATE  EMP_ATTENDANCEE
    SET           DATE_OUT   =  TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'), -- DATE_OUT,
                  TIME_OUT   =   TO_DATE(:NEW.LOGTIME,'HH24:MI:SS') -- TIME_OUT
    WHERE   EMP_ID           =   TO_NUMBER(TO_CHAR(:NEW.employeeid,99999))
    AND DATE_IN =  (SELECT MAX (DATE_IN )
                    FROM EMP_ATTENDANCEE
                    WHERE EMP_ID = EMP_ID
                    AND   DATE_OUT IS NULL
                    AND   TIME_OUT IS NULL ) ;
              SELECT COUNT(employeeid )
                 INTO V_COUNT
                FROM ACCESSLOG
                WHERE employeeid =:NEW.employeeid
                AND LOGDATE =:NEW.LOGDATE
                AND  LOGTIME  =:NEW.LOGTIME
                AND INOUT ='OUT';
                IF V_COUNT > 0 THEN
INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
     VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
             TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
      TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
     0); -- check in
END IF;
END IF;
  EXCEPTION
   WHEN OTHERS  THEN RAISE;
END EMP_ATTENDANCEE_MONA ;The above Trigger generates the following error:
ORA-04091: table ASSIUT.ACCESSLOG is mutating, trigger/function may not see it
ORA-06512: at "ASSIUT.EMP_ATTENDANCEE_MONA'", line 65
ORA-04088: error during execution of trigger 'ASSIUT.EMP_ATTENDANCEE_MONA'i want an easy and a straight forward solution to this problem which occured on selecting or manipulating from the same table i triggered it.
Best regards,
Abdetu..

Create a package
CREATE OR REPLACE PACKAGE PK_TRIGGER IS
  PROCEDURE PR_BS;
  PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE);
  PROCEDURE PR_AS;
END;
CREATE OR REPLACE PACKAGE BODY IS
  TYPE tData IS RECORD (
    vcType     TABLE.COLUMN%TYPE,
    nEmpid     TABLE.COLUMN%TYPE,
    vcLogDate TABLE.COLUMN%TYPE,
    vcLogTime TABLE.COLUMN%TYPE
  TYPE tDataList IS TABLE OF tData INDEX BY BINARY_INTEGER;
  lData tData;
  PROCEDURE PR_BS IS
  BEGIN
    lData.DELETE;
  END;
  PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE) IS
    iPos PLS_INTEGER:=lData.COUNT+1;
  BEGIN
    lData(iPos).vcType:=i_vcType;
    lData(iPos).nEmpId:=i_nEmpId;
    lData(iPos).vcLogDate:=i_vcLogDate;
    lData(iPos).vcLogTime:=i_vcLogTime;
  END;
  PROCEDURE PR_AS IS
    CURSOR crCheck(i_nIdentnum IN NUMBER) IS
      SELECT 1
        FROM <YOURTABLE> A,
             <YOURTABLE> B
       WHERE A.IDEN_NUM=B.IDENT_NUM
         AND (   A.BEGIN_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
              OR A.END_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
    iPos PLS_INTEGER;
    nDummy NUMBER;
  BEGIN
    iPos:=lData.FIRST;
    LOOP
      EXIT WHEN iPos IS NULL;
      -- Do whatever you want with the data in the record
      -- Process next record
      iPos:=lIds.NEXT(iPos);
    END LOOP;
    lIds.DELETE;
  END;
END;replace TABLE.COLUM%TYPE with appropiate table and column
Now create a
- Before Statement trigger on your table calling PK_TRIGGER.PR_BS;
- After Insert on Update for each row Trigger calling PK_TRIGGER.PR_ARIU(...values...);
- After Statement trigger on your table calling PK_TRIGGER.PR_AS;
Hope the code compiles for i have no database at hand.
Andreas

Similar Messages

  • How to activate JDBC debugging for SPRING 3.1? Oracle trigger problems ...

    Hi,
    I have some trigger problems. I created a trigger to update a certain column each time a new record is inserted or an existent record is updated. I use Oracle 10g. If I create the trigger and execute an insert query via the XE client everything works fine. However, when I use a spring 3.1 setup with Hibernate and OJDBC driver, I get an
    java.sql.SQLException: ORA-04098: trigger 'LOCALUSER_PROP_TRIG' is invalid and failed re-validation
    And if I execute a show error trigger query I get an invalid SQL query error.
    I can easily activate Hibernate debugging and I can see that the prepared statement by Hibernate is just fine, but I was wondering if I could see the full sql sent by the JDBC driver to the server. Maybe seeing the actual query sent to the server would provide new insight of what could be wrong in the Hibernate setup. Does any one what could be wrong and eventually how could setup jdbc to output debug info? Thanks a lot,
    Cristian

    Which platform is the database running on ??
    Other things you should check -
    when debugging the EJB, JDev
    3.1 looks through your IIOP connections to find the one to use.
    Make sure that the IIOP connection that JDev is using for the debugging matches the IIOP connection that the EJB client application is using.
    raghu
    null

  • Trigger Problem, need help in 8i

    SQL> Create table a (sno char(3), kkk varchar2(30));
    SQL> Create or replace trigger T$a before insert on a
    for each row
    begin
    if :new.sno = 'FFF' then select nvl(max(sno),0)+1 into :new.sno from a;
    end;
    SQL> insert into a select 'FFF', cont_no from gcmis.cont_rent;
    insert into a select 'FFF', cont_no from gcmis.cont_rent
    ERROR at line 1:
    ORA-04091: table TR.A is mutating, trigger/function may not see it
    ORA-06512: at "TR.T$A", line 2
    ORA-04088: error during execution of trigger 'TR.T$A'
    Why & How?

    It happens because you read the table that was in the middle of being modified by your trigger...
    The only way to proceed is to rewrite your statement so it does not read the table.
    For example, you can store the maxvalue of your field in another table...
    But don't forget that if sno is a unique key, you'll probably have problems when working with a mutli-users app...
    SQL> Create table a (sno char(3), kkk varchar2(30));
    SQL> Create or replace trigger T$a before insert on a
    for each row
    begin
    if :new.sno = 'FFF' then select nvl(max(sno),0)+1 into :new.sno from a;
    end;
    SQL> insert into a select 'FFF', cont_no from gcmis.cont_rent;
    insert into a select 'FFF', cont_no from gcmis.cont_rent
    ERROR at line 1:
    ORA-04091: table TR.A is mutating, trigger/function may not see it
    ORA-06512: at "TR.T$A", line 2
    ORA-04088: error during execution of trigger 'TR.T$A'
    Why & How?

  • HRMS Mutating Custom Trigger Error

    Hi Gurus! In Oracle 10.7 SC HRMS, the column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F was used to populate the actual person type. In releases 11+, this column was redesigned to hold just the default user_person_type for a given system_person_type. It is not maintained to reflect the true user person type. Only the table person_type_usages_f will give you the true user_person_type. (Note: column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F is ONLY used by non-HR areas, such as Purchasing)
    This link explains this:
    http://www.aboutoracleapps.com/2008/07/difference-between-perallpeoplefpersont.html
    My issue- our client upgraded from 10.7 to R12. The issue is that their custom code (a lot of it) looks at the column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F to determine the actual person type.
    Since my client doesnt use Purchasing (or any other modules), and they have LOTS of custom code that looks at the PERSON_TYPE_ID column, it was decided that we would just populate that column with the correct person type.
    We created a trigger on the PER_PERSON_TYPE_USAGES_F table. Basically, any time a person type changes, the PERSON_TYPE_ID column is updated in the PER_ALL_PEOPLE_F table. Simple update.
    The problem is, we get a mutating table error. Does anyone see why? Or how my logic is not sound? Thank you.
    Trigger:
    BEFORE INSERT OR UPDATE ON "APPS"."PER_PERSON_TYPE_USAGES_F" FOR EACH ROW
    BEGIN
         UPDATE PER_ALL_PEOPLE_F
         SET PERSON_TYPE_ID = :new.person_type_id
         WHERE person_id = :NEW.person_id
         AND sysdate BETWEEN effective_start_date AND effective_end_date;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(-20005, 'Trigger UPDATE_PERSON_TYPE_ID: '||SQLERRM);
    END;
    Application Error:
    ORA-20005: Trigger UPDATE_PERSON_TYPE_ID: ORA-04091: table HR.PER_PERSON_TYPE_USAGES_F is mutating, trigger/function may not see it
    ORA-06512: at "APPS.PER_ALL_PEOPLE_F_ARIU", line 228
    ORA-04088: error during execution of trigger 'APPS.PER_ALL_PEOPLE_F_ARIU'
    ORA-04088: error during execution of trigger 'XXMIL.UPDATE_PERSON_TYPE_ID'
    ORA-06512: at "APPS.PER_PTU_SHD", line 398
    ORA-06512: at "APPS.PER_PTU_UPD", line 256
    ORA-06512: at "APPS.PER_PTU_UPD", line 338
    ORA-06512: at "APPS.PER_PTU_UPD", line 781
    ORA-06512: at "APPS.PER_PTU_UPD", line 915
    ORA-06512: at "APPS.HR_PER_TYPE_USAGE_INTERNAL", line 357
    ORA-06512: at "APPS.HR_PER_TYPE_USAGE_INTERNAL", line 757
    ORA-06512: at "APPS.HR_PER_PEOPLE12_PKG", line 1311

    Jason,
    you should push to change your custom code.
    Direct update over seeded tables is not supported by Oracle.
    per_people_f updates are allowed only through front end or API, and I doubt there is an API to update the person_Type_id.
    Furthermore it's way a bloody road to have the trigger, maintain it over upgrades and patches, have it firing at the right time (order in which they fire is not predictable), have data the consistent if you eventually upgrade to iREc o Benefits (when the person type could become ex-Employee.Applicant....).
    I believe triggers on per_people_f are not recommendable (except for auditing). You should create your custom function and substitute any person_type_id occurrence with your custom function (or use the hr_person_type_usage_info.get_user_person_type or another if suit you well).
    If you are upgrading from 10.7 to 12i, a lot of rework should be envisaged, so there should be room to create a business case to stick to oracle standard and adjust your custom code. Indeed you should check wth Oracle if what proposed is actually supported by them, this would eventually make your recomendation accepted.
    my 2c.
    Giuseppe
    Edited by: Giuseppe on 07-Jun-2012 10:27

  • BIG Trigger Problem!!!

    Hi friends,
    I need to write a before insert and update trigger,that Select and (insert respectively update) the same table.
    I tried some solutions
    like the solution of Tom -->askTom
    here is the Link http://asktom.oracle.com/~tkyte/Mutate/index.html
    but that don't work for me. The problem is that I have
    first to select something from Table A and then
    check this with the values which have to be inserted or updated in Table A. Only when the the new values(from one column) are not in Table A they can be inserted or updated.Otherwise the Trigger have to raise an error.
    Can somebody tell me a way how to implement such a trigger???Please with an example.
    thanxx
    Schoeib

    As far as I know there is no easy solution for this. There is a good reason why Oracle throws the mutating table exception in its BEFORE triggers. One possible way round it is to use a view with an INSTEAD OF trigger on it, and prevent people have direct access to the table..
    However, it does seem to be as though you are trying to get the database to resolve problems that really ought to solved at the front-end. If at all possible you should try to correct whatever application is entering data into your system.
    Cheers, APC

  • Post query trigger problem in master detail oracle forms

    Hello experts,
                        I am new in oracle forms n using Fission middleware 10g with oracle forms 11g at windows 7 platform.
    I have made a master detail form using a tab canvas.There is a database column STUDENTID and it is in my student tab with a TBL_STUDENTENTRY data block.Now I Have an another tab named previous_education with TBL_STUDENT_PREVIOU_EDU datablock here there is also a database column STUDENTID and corresponding field in my  previous_education TAB under TBL_STUDENT_PREVIOU_EDU  datablock.Now i want to add a display item to show  student name corresponding to STUDENTID.For this I have tried to make a select query in TBL_STUDENT_PREVIOU_EDU data block POPST_QUERY TRIGGER.
    begin
    select STUDENTNAME into :TBL_STUDENT_PREVIOU_EDU.STD_NM   from TBL_STUDENTENTRY where STUDENTID=:TBL_STUDENTENTRY.STUDENTID;
    end;
    But, This trigger is not fired at runtime,Please suggest me what is going wrong and give me the solution.
    Thank You
    AADITYA.

    http://www.club-oracle.com/forums/post_query-problem-in-oracle-forms-t9751/#post23794 ,  This is the link at where  I have tried to show my problem with the help of an image,Please get the link:
    thanx
    regards Aaditya.

  • Post-trigger problem in master detail form.

    I have designed a master detail form having two data blocks.
    in detail data block there is a post-query.
    when i tried delete one record in master block
    an error occurred ie
    'frm-40654. Record is updated by another user
    re-query to see changes'.
    in detail block there are 3 non database items.
    when i delete the post-query trigger the record is deleting properly.but the post-query trigger is also needed to display the non database item values. please give me a solution to tackle this problem.

    Hi,
    Even though yout items are non-database items, when you assign a value to them forms sets the block status to "CHANGED".
    Add the following lines add the end of your post-query trigger to reset the block status to "QUERY"
    set_record_property (GET_BLOCK_PROPERTY('YOUR_BLOCK_NAME',CURRENT_RECORD)
    ,name_in('system.cursor_block')
    ,STATUS
    ,QUERY_STATUS
    Hope this helps,
    Hugo

  • Enterprise Manager 10g & trigger problem

    Hi.
    Trying to create a trigger using Enterprise manager 10g WEB Console and trigger creating "wizard" without success.
    Example: I've added a simple trigger using SQL+ (this works ockey):
    CREATE OR REPLACE TRIGGER "SRECKO".TESTNA_TRIG BEFORE
    INSERT ON "SRECKO"."TESTNA" REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW begin
    select testna_seq.nextval into :new.kljuc from dual;
    end;
    If I use Enterprise's Manager feature and I construct this trigger with (General/Event/Advanced) tabs it just doesn't work. I allways get the same SQL Error (missing IN or OUT parameters -> PreparedStatement bug ???).
    Has anybody had any similar experiences ?
    matev¾

    I am having the same problem. Unfortunately, it looks like no one else is or no one else has an answer. I will check back again later. Right now I am going to try and google and answer. Hope someone responds here.

  • Post-change trigger problem

    I have problem with post-change trigger, i'm using Forms 10g
    I have two block, one is database block and the other is non-database block for example A is Nondatabase block and B is Database block, I have written commit_form built-in in Key-Next-Item of a item in B(database) block. When it is getting executed commit_form built-in firing the post-change trigger of a item in A(Non-database) block. I dont know why it is firing and I dont want the post-change trigger to fire (we are not assigning any value to that item in A block during commit_form).
    Can anybody help me on this..
    Regards
    Radha

    when you issue a commit_form, forms will validate all items in all blocks which re not valid at that moment. This also occurs for non-database-block.
    The question is why is the item not valid ? Are you putting something in it in some other trigger? If so, you could explicitly set the itemstate to valid with a
    SET_ITEM_PROPERTY('BLOCK.ITEM', ITEM_IS_VALID, PROPETY_TRUE);btw.. you should not use the POST-CHANGE-trigger for validations etc. its better to use the WHEN-VALIDATE-ITEM-trigger.

  • Trigger problem on Sql Server with linked server to Oracle

    Hi All,
    I have a simple insert trigger on Sql Server 2005, it uses linked server to Oracle.
    like that ;
    USE [YTM08]
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ANSI_NULLS ON
    go
    ANSI_WARNINGS ON
    CEATE TRIGGER [dbo].[YTM_TBLSTSABIT_I]
    ON [dbo].[TBLSTSABIT] FOR INSERT
    AS
    BEGIN
    INSERT INTO YTM_ORACLE..SECTOR.STOCKS
    stock_name,
    stock_code,
    insert_date
    SELECT
    SBT.STOCKNAME,
    SBT.STOCKCODE,
    GETDATE()
    FROM INSERTED SBT
    END
    The YTM_ORACLE is a linked server and it's provider is OraOLEDB.Oracle.
    Trigger does not works for that linked server but other triggers for local
    sql server works fine...
    I get this error from sql server
    'Heterogeneous queries require the ANSI_NULLS and
    ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.'
    Does someone know how to solve this issue the right way?
    Thanks in advance.
    Thanks !
    Adam

    Hi Lars,
      Thanks for the data. I've already read this note and configure all this parameters. But when I'm executing the Create Source System in the BI system the process dies.
      If I look into the logs I see this:
    M  call semaphore clean-up function ...
    M  ***LOG Q0E=> DpSigGenHandler, Exception (c06d007e) [dpnttool.c   432]
      That's the reason why I start guessing about other possible problem.
    Regards

  • DB Trigger Problem??

    Hi ,
    I have one problem :
    By using database trigger on EMP table I have to update the salary of all the subordinates by 10% if their Manager's Salary is incremented by 5%.
    I did it by using a package -that contains PL/SQL Table to store the Manager's Emp No those got increment and their old & new Salary.
    Before Update Trigger(Row-Level Trigger) to assign the values in the PL/SQL table. and
    After Update(statement Level Trigger)-That reads the manager's empno,old salary & new salary from PL/SQL table and update the EMP table for their Subordinates.
    But It gives me the Recursive SQl error.
    Pls Help Me ASAP
    Regards.
    Suneel

    There is a good reason for this behaviour. You are trying to automate something that probably shouldn't be automated. Consider:
    SELECT * FROM my_emp
    ID  JOB        MGR_FLAG  MGR  SAL
    1   PRESIDENT  Y              5000
    2   SALESMAN   Y         1    2500
    3   GRUNT      N         2    1400If I issue the following SQL :
    UPDATE my_emp
    SET    sal = sal*1.05
    WHERE  mgr_flag = 'Y'
    / what should happen? Well, employees 1 and 2 should get a 5% pay rise because they are managers. And employee 3 gets a 10% pay rise, because her manager got 5%. So far so cool. But hang on a moment, employee 2 is managed by employee 1 so, as employee 1 got a 5% pay rise, employee 2 is entitled to a 10% pay rise.
    Now, which order do these things get processed in? Because that might make a difference. As it happens, ((2500 * 1.05) * 1.10) = 2887.5 whereas ((2500 * 1.10) * 1.05) = 2887.5. So it doesn't make a difference, in this case.
    But Oracle doesn't know that. With a more complicated algorithm e.g.
    IF sal < 2700
    THEN sal := sal+100;
    ELSE sal := sal * 1.05; 
    END IF;the order the rows are processed in will make a difference. And because it is impossible to forecast beforehand in which order rows will get processed Oracle baulks. It only allows SQL which has predictable results.
    Furthermore, the logic is dubious. Is it right for employee 2 to receive two pay rises? Is it right for employee 3 to receive two pay rises as well?
    Sure, using AUTONOMOUS TRANSACTION will suppress the error message. But the logic of the design remains flawed. I hope you now understand why this is not a good idea.
    Cheers, APC

  • Mouse Leave Trigger Problem

    hi,
    I am using Oracle 9i Forms on windows 2000 Server.
    My Form [32 bit] Builder Version is : 9.0.2.7.0
    I am facing a problem using the WHEN-MOUSE-LEAVE Trigger.
    I have applied this trigger on an ITEM in a DATA BLOCK but the Trigger is not fired when i leave the item using the mouse.
    Can any one guide me, as i may be missing something important.
    Thanks.
    Samir Farooq.

    Are you running on the web ? Mouse movement triggers are disabled on web forms as they generate too much network traffic.

  • BAPI inside WF event trigger problem

    Hi Guys,
    Here's my problem:
    I'm triggering a WF from the Business objects BUS2032, event CHANGED (for sales orders). But the first step in the workflow is to block the order for delivery, so I'm using the BAPI BAPI_SALESORDER_CHANGE to modify the field delivery block of that sales order.
    The problem is that when the BAPI is executed, the event CHANGED from the BO BUS2032 is triggered, so the WF is triggered again, and so on...it's like a loop.
    So my question is, is there a way to modify the sales order inside the WF without triggering any event inside the WF?
    Thanks!

    Hi MatiasAZ,
      Change standard code to not trigger the event is not recommended.
      Alternatively,You can put a check in your workflow to complete itself if there is another workflow is running for the same sales order.
       Or you can also put filter function module on the event linkage via transaction SWETYPV not to trigger the event if there is a workflow running for that sales order.
      Transaction SWI6 can tell you that any workflow with specific object is running.
    Chaiphon

  • Photoshop rollover in Lightbox Widget Trigger Problem

    Hi all
    I've got a lovely photoshop button with a nice rollover effect and it looks great. I've been trying to use it in the trigger of a Lightbox Widget as per the instruction in this thread:
    http://forums.adobe.com/message/4768861#4768861
    The problem is that the rollover isn't triggered when rolled over. The rollover state of the trigger changes but the PSD doesn't.
    Can anyone help?

    You seem to have missed something there.
    Please check the result of following the steps in that forum post: http://testpsmuse.businesscatalyst.com/index.html
    The third trigger is the one that contains the Photoshop Button. Could you confirm that you imported the PSD using File > Place Photoshop Button... and not File > Place...
    Cheers,
    Vikas

  • After insert trigger problem

    I am trying to write a trigger which will update a date col after every insert////
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    AFTER INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    declare PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    update ps1.COMMNPLANBUDGET set CREATION_DATE=sysdate where PROJECTID = :new.PROJECTID;
    commit;
    END XX_CDATE;
    For the same i have written the above code, it created successfully but when i am inserting a record the date col is not getting updated. Please let me know where i have done wrong. Thanks in advance

    Hello
    You should not use autonomous transactions in a trigger. Do not do it, and if anyone tells you to use autonomous transactions in a trigger to avoid mutating table exceptiosn, you should instruct them to put their hands in a toaster, switch it on maximum and insist they keep them there until the timer reaches zero.
    Anyway, if the primary key on this table is project ID, you don't need to go to these lengths. You can simply
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    BEFORE INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    BEGIN
        :NEW.creation_date := sysdate;
    END XX_CDATE;If project_id is not the primary key, why would you update the creation date for all rows attached to the project id?
    David
    Edited by: Bravid on Sep 22, 2011 9:29 AM
    Oops, after reading Karthik's post, I realised I left the AFTER insert in the trigger spec. Updated it to BEFORE.

Maybe you are looking for

  • Session in ATG

    Hi,   For what functionality session is used in ATG, i.e what is the use of session in ATG. and how is it achieved in ATG???? Components : session scoped Repository : Transient properties   Session cookies: ???? Regards

  • IPhone 5 backup failed

    I tried several times to backup my iPhone 5 but failed. Several times it only run for 1 minute and told me 'the last backup could not be completed.' This morning, it run for almost 1hr and told me the same. The last backup still keeps in 2013. What s

  • RTP300-NA v1.1 slow to some web sites with Vista (XP ok)

    I have a RTP300-NA VoIP router (v1.1) which works perfectly with Windows XP, but not with Windows Vista. With Vista some web sites work OK, while others have a ~2 min delay. These web sites appear completely and quickly after the initial 2 min. It se

  • Disk format error running Snow Leopard

    Hi all, simply trying to erase/reformat a LaCie 350 GB external hard drive.    I keep getting the error that the disk won't unmount. How can I get around this and does this mean I shouldn't rely on this EHD. I'm reformatting it to load up some video

  • Error changing data type to date in column containing blanks

    I am pulling data from an OLAP cube into PowerPivot. My data set contains several date columns wich are formatted as YYYY-MM-DD string values. After successfully importing the data, I am trying to set the data type of these columns to date. Apparentl