Error in Creating Trigger

Hi All,
I have a problem in creating a trigger.
I have two fields named last_updated_by, last_updated_date which
r common to all the tables.
If the user made any change to the exiting record, the values of
the those two colums should get changed automatically with the
username and sysdate.
When I wrote a trigger its giving mutation error.
Can I update these value by stored procedure via trigger?
I heard its possible by DBMS_JOB package. Can anyone give idea?
Thanks in Advance.
Regards
Gopinath Kona

You should only get the mutating table probllem if you're doing
SELCT or DML against the table the trigger's built on. Which
suggests that you're approaching this the wrong way.
Try CREATE TRIGGER blah blah
FOR EACH ROW
:new.last_updated_by := USER;
:new.last_updated_date := SYSDATE;
END;
If that's what you are doing then the problem lies elsewhere.
Rgds, APC

Similar Messages

  • Getting error while creating trigger!!

    Hi Guys,
    I am getting the following error while creating trigger in Oracle10g Database in TOAD environment.
    Error: PLS-00306: wrong number or types of arguments in call to '='
    Table details:
    One of the column having BLOB Data type in the table.
    In the trigger, I have compared :old and :new values.
    CREATE OR REPLACE TRIGGER INPL.trigger_new
    AFTER INSERT OR UPDATE OR DELETE
    ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    action_flag VARCHAR2(1);
    new_image BLOB;
    BEGIN
    IF UPDATING
    THEN
    action_flag := 'U';
    ELSIF DELETING
    THEN
    action_flag := 'D';
    ELSIF INSERTING
    THEN
    action_flag := 'I';
    END IF;
    IF (:NEW.image = :OLD.image)
    THEN
    new_image := '';
    ELSE
    new_image := :NEW.image;
    END IF;
    INSERT INTO TABLE_NEW(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
    end;
    Any one knows about this issue, please let me know with the proper solution.
    Thanks for your immediate response!
    Regards,
    Lakshman

    CREATE OR REPLACE TRIGGER INPL.trigger_new
    AFTER INSERT OR UPDATE OR DELETE
    ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    action_flag VARCHAR2(1);
    new_image BLOB;
    BEGIN
    IF UPDATING
    THEN
    action_flag := 'U';
    ELSIF DELETING
    THEN
    action_flag := 'D';
    ELSIF INSERTING
    THEN
    action_flag := 'I';
    END IF;
    IF (:NEW.image = :OLD.image)
    THEN
    new_image := '';
    ELSE
    new_image := :NEW.image;
    END IF;
    INSERT INTO TABLE_AUD(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
    end;
    I am getting the error in line at If condition
    Error: PLS-00306: Wrong number or tpyes of arguments in call '='
    Please let me know if any one knows exact solution!
    Thanks in advance!
    Regards,
    Lakshman

  • Bad bind variable error on creating trigger

    hi
    im trying to create a trigger on a table in Oracle and I keep gettin this error:
    PLS-00049: bad bind variable 'NEW.ID'
    TeamID is a primary Key, it creates the sequence fine, but i get the error on the create trigger,
    CREATE TABLE TBLTEAMS
    TEAMID NUMBER(5),
    NAME VARCHAR2(50 BYTE),
    MANAGER VARCHAR2(50 BYTE),
    COSTCENTRE NUMBER(9),
    PARENTTEAMID NUMBER(5)
    create sequence seq_Teamsautonumber;
    create trigger trg_Teamsautonumber
    before insert on tblteams
    for each row
    begin
    select seq_Teamsautonumber.nextval into :new.id from dual;
    end;
    any ideas?

    You have said
    :new.idthat means you are trying to load the sequence value into a column that doesn't exist in your table.
    you would need to use
    :new.teamidAssuming you are trying to auto-populate the TEAMID column on your table.

  • Error while create trigger on for nested table

    I want to insert a record into a nested table.For this, I created a view for the table, which includes the nested table.It told me ORA-25015 cannot perform DML on this nested table view column.So I created a trigger for the nested table.However, it told me that ORA-25010 Invalid nested table column name in nested table clause.I think my nested table is valid, i don't konw why did it appear this kind of problem?
    My table is
    CREATE TABLE ENT
    ID NUMBER(7) NOT NULL,
    CREATE_DATE VARCHAR2(11 BYTE),
    UPDATE_DATE VARCHAR2(11 BYTE),
    DEPTS VARRAY_DEPT_SEQ
    CREATE OR REPLACE
    TYPE DEPT AS OBJECT
    ID NUMBER(8),
    ANCHOR VARCHAR2(20),
    CREATE OR REPLACE
    TYPE " VARRAY_DEPT_SEQ" as varray(930) of DEPT
    CREATE OR REPLACE VIEW ENT_NESTED_VIEW
    (ID, CREATE_DATE, UPDATE_DATE, DEPTS)
    AS
    select e.ID,cast(multiset(select r.id,r.anchor from ent z, table(z.depts) r where z.ID=e.ID )as varray_dept_seq)
    FROM ENT e
    Then when I created trigger;
    CREATE OR REPLACE TRIGGER EMP.ENT_NESTED_TRI
    INSTEAD OF INSERT
    ON NESTED TABLE DEPTS OF EMP.ENT_NESTED_VIEW
    REFERENCING NEW AS New OLD AS Old PARENT AS Parent
    FOR EACH ROW
    BEGIN
    END ;
    I met the problem: ORA-25010 Invalid nested table column name in nested table clause
    Could you please tell me the reason
    Thank you!
    My insert SQL is:
    insert into table(select depts from ent_nested_view where id=1856) values(varray_dept_seq(dept(255687,'AF58743')))
    Message was edited by:
    user589751

    Hi,TongucY
    Compared with the "Referencing Clause with Nested Tables" part of this reference -
    http://psoug.org/reference/instead_of_trigger.html, I found the answer of this
    quesion. That is "CREATE OR REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of
    DEPT". It turns to be a varying array, not a nested table. It should be "CREATE OR
    REPLACE TYPE " VARRAY_DEPT_SEQ" as table of DEPT". That is OK. Thank you very
    much!
    While there is an another question, if I create a varying array like" CREATE OR
    REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of DEPT " and I want to insert
    a record into the varying array, which the record has been existed.The method that
    create a view and a trigger seems not to be effective.
    For instance,
    There is a record in the table
    ID:1020
    CREATE_DATE:2005-10-20
    UPDATE_DATE:2007-2-11
    DETPS: ((10225,AMY))
    I want to ask this record to be
    ID:1020
    CREATE_DATE:2005-10-20
    UPDATE_DATE:2007-2-11
    DETPS: ((10225,AMY),(10558,TOM))
    How should I do?
    Could you please help me?
    Best regards.
    Message was edited by:
    user589751

  • Error while creating trigger

    Hai All
    I have table called Daily_attendance
    I need to track the changes made in the table..
    I have written a trigger
    create or replace trigger dail_attendance
    after delete or insert or update on Daiyl_attendance
    for each row
    begin
    insert into audit_dail_att_table(user_name,timestamp,emplcode,old_timein,new_timein,old_timeout,new_timeout,old_attend_date,old_attn_status,old_deptcode)values
    (user,sysdate,:old.emplcode,:old.timein,:new.timein,:old.timeout,:new.timeout,:old.attend_Date,:old.attn_status,:old.deptcode);
    end;
    show err;
    And i got the error
    Warning: Trigger created with compilation errors.
    Errors for TRIGGER DAIL_ATTENDANCE
    Thanks In Advance
    Srikkanth.M

    Hi Srikkanth,
    As karthik has pointed out you should decide on what needs to be captured in the audit tables...
    just to give a heads up...
    usually the audit tables contain all the info of main table + the audit_timestamp(when the change was made), the user who made the change and the operation(if it is delete/insert/update)..this can be obtained in the trigger using:
    If inserting...
    set operation = 'I'
    elsif updating
    set operation ='U'
    else
    set operation = 'D'
    end if;
    hope this gives you an idea...
    also now there are other methods of auditing like fine grain auditing and Change Data Capture, CDC is a good set up for auditing as far as i know...u should think of what is best for your application...
    Edited by: Roy Mathew on May 27, 2010 3:51 AM

  • Getting error in creating trigger or CSQ

    HI
    I am facing a strange issue in doing any new config in my uccx vers 8.5.2 ,
    I also uploaded the .cop file availabe in the cco .
    while creating or doing any modifucation i am getting below error  :
    There was an error while interacting with the Database. "
    or
    An error occurred while saving the CSQ Configuration data. "
    Also in the dignosis test in uccx cli i m finding the below test fail
    est - tomcat_connectors   : Failed - The HTTP and HTTPS ports are not responding to local requests.  Please collect all of the Tomcat logs for root cause analysis: file get activelog tomcat/logs/*
    and in the file get activelog tomcat/logs/* logg for localhost file getting the below last entry
    [15/Dec/2011:00:05:19 +0530] 127.0.0.1 127.0.0.1 XuKR3_b9qn - 8080 GET /manager/list  HTTP/1.1 200 1446 4
    [15/Dec/2011:00:05:40 +0530] 127.0.0.1 127.0.0.1 XuKR3_b9qn - 8080 GET /manager/list  HTTP/1.1 200 1446 4
    [15/Dec/2011:00:06:01 +0530] 127.0.0.1 127.0.0.1 XuKR3_b9qn - 8080 GET /manager/list  HTTP/1.1 200 1446 4
    [15/Dec/2011:00:06:22 +0530] 127.0.0.1 127.0.0.1 XuKR3_b9qn - 8080 GET /manager/list  HTTP/1.1 200 1446 4
    [15/Dec/2011:00:06:42 +0530] 127.0.0.1 127.0.0.1 XuKR3_b9qn - 8080 GET /manager/list  HTTP/1.1 200 1446 1
    file view activelog tomcat/logs/localhost.2011-12-15.log
    Dec 15, 2011 3:03:23 PM org.apache.catalina.core.ApplicationContext log
    INFO: UCCX Plugin initializer::successfully initialized webapp :appuser
    Dec 15, 2011 3:03:28 PM org.apache.catalina.core.ApplicationContext log
    INFO: action: []: Verifying ModuleConfig for this module
    Dec 15, 2011 3:03:28 PM org.apache.catalina.core.ApplicationContext log
    INFO: action: []: Verification of ModuleConfig has been completed
    Dec 15, 2011 3:03:32 PM org.apache.catalina.core.ApplicationContext log
    INFO: UCCX webapp being initialized :dp, currently deployed UCCX webapp's count :5
    Dec 15, 2011 3:03:32 PM org.apache.catalina.core.ApplicationContext log
    INFO: UCCX Plugin initializer::initializing webapp dp
    Dec 15, 2011 3:03:32 PM org.apache.catalina.core.ApplicationContext log
    INFO: UCCX Plugin initializer::successfully initialized webapp :dp
    i dount if this issue is causing the problem of adding any new entry ...
    also in the unified servicibality page not getting list of any service ...

    The serviceability page you have posted is not used for UCCX.
    Look at "Cisco Unified CCX Serviceability" and make sure everything is "In Service"
    Looking at your name this looks like a HA system. Are both systems up and running as you can't save changes if only one of the HA systems is up.
    In "Cisco Unified CCX Serviceability" go to Tools/Datastore Control Center/Datastores and make sure all 4 of your datastores are replicating correctly
    Graham

  • Error in creating a trigger

    i am creating a trigger i am getting an error
    create or replace TRIGGER INS_Discharge
    AFTER INSERT
    ON Discharge
    FOR EACH ROW
    AS
    declare
    vr_DischargeType INT ;
    vr_Visit_ID INT ;
    vr_Discharge_Date DATE;
    vr_VisitDate DATE;
    vr_AdmTime varchar(5) ;
    vr_TransferID INT ;
    vr_BedID AS INT ;
    BEGIN
    select :NEW.DischargeType into vr_DischargeType
    from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date
    from dual;
    select :NEW.VisitDate into vr_VisitDate
    from dual;
    SELECT VisitDate into vr_VisitDate FROM Visit WHERE Visit_ID = vr_Visit_ID ;
    UPDATE Visit SET DischargeType = vr_DischargeType, DischargeDate = vr_Discharge_Date
    WHERE Visit_ID = vr_Visit_ID ;
    SELECT MAX(Transfer_ID)into vr_TransferID FROM BedSchedule WHERE VisitID = vr_Visit_ID ;
    IF vr_DischargeType = 2 then
    SELECT Bed_ID into vr_BedID FROM BedSchedule WHERE Transfer_ID = vr_TransferID ;
    UPDATE Bed_Mst SET Bed_Status_ID = 1 WHERE Bed_ID = vr_BedID ;
    :NEW.Bed_ID :=vr_BedID;
    end if;
    END ;
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    i have done you said .... i have oracle version 10g
    create or replace TRIGGER trUPD_Discharge
    AFTER UPDATE
    ON Discharge
    for each row
    AS
    declare
    vr_DischargeType INT ;
    vr_Discharge_Date DATE;
    vr_Visit_ID INT ;
    vr_CancelStatus INt;
    BEGIN
    /*select :NEW.DischargeType into vr_DischargeType from dual;
    select :NEW.Visit_ID into vr_Visit_ID from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date from dual;
    select nvl((select :NEW.CancelStatus from dual),0)
    into vr_CancelStatus from dual;
    If vr_CancelStatus = 0 then
    UPDATE Visit SET DischargeType = :NEW.DischargeType,
    DischargeDate =:NEW.Discharge_Date WHERE Visit_ID = :NEW.Visit_ID ;
    end if;
    END;
    but still getting same error
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Errore ORA-04098 creating Trigger.

    hi,
    I have some problem creating a simple trigger for auto increment of an "Id_column".
    I create a sequence: create sequence "sequence_name" minvalue 1 maxvalue 999 increment by 1
    then create trigger: create trigger "trigger_registry"
    before insert on "registry"
    for each row
    when (new.ID_registryA is null)
    begin
    select "Sequence_name".nextval into: new.ID_registry
    FROM DUAL;
    END;
    and finally I try to insert something into registry table but I got this error: ORA-04098: il trigger 'SYSTEM.TRIGGER_NAME' is invalid and failed re-validation.
    Has anybody got any idea about this error?

    user3745218 wrote:
    ok, so i've corrected all but the error is still the same: ORA-04098: il trigger 'SYSTEM.TRIGGER_NAME' is invalid and failed re-validation.
    Unless you post SQL*PLus snippet like this, we can't help you:
    SQL> create or replace
      2  trigger emp1_bir
      3  before insert
      4  on emp1
      5  for each row
      6  when (new.sal < 0)
      7  begin
      8  select sss.nextval into :new.empno from dual;
      9  end;
    10  /
    Warning: Trigger created with compilation errors.
    SQL> show error trigger emp1_bir
    Errors for TRIGGER EMP1_BIR:
    LINE/COL ERROR
    2/1      PL/SQL: SQL Statement ignored
    2/8      PL/SQL: ORA-02289: sequence does not exist
    SQL> SY.

  • Error while creating sequence - related to xdb installation?

    I'm getting the following error while creating a sequence -
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20000: Trigger xdb_installation_trigger does not support object creation of
    type SEQUENCE
    ORA-06512: at line 32
    oracle xml db was installed on this instance.
    Is there a way around it? We want oracle xml db installed but we still want to be able to create and drop sequences!

    Hi Expert,
    In T-Code: OB52, We need to open the period 001 for Year - 2012 for the Account Type - S and for GL Account - 799999.
    Configure as shown below for your Posting Period Variant:
    Account Type: S
    From Account: (Only provide any GL Accounts From Range, If you require any specific GL Accounts to be open. Else leave blank)
    To Account:(Only provide any GL Accounts To Range, If you require any specific GL Accounts to be open. Else leave blank)
    From Period: 01
    Year: 2012
    To Period:01
    Year:2012
    From Period:13
    Year:2012
    To Period:16
    Year:2012
    Save
    Regards,
    GK
    SAP

  • Use of "DBA_OBJECTS" in "AFTER CREATE" Trigger

    Hi,
    We would like to store some extra information about our objects we have in the database. To do so we tought of the idea of creating a 'documenting' table containing an object_id that references to the object_id from the view dba_views.
    Now we want to automatically create a new record in our documenting table when a new object is created, in the first stage this should only contain the object_id
    To accomplish this we are using an 'AFTER CREATE' trigger, but when this trigger fires and the code searches for the new object_id in dba_objects, it does not return any records and generates an error. Likely because when the trigger is executed, the view is not yet updated?
    create or replace
    TRIGGER TRG_TEST
    AFTER CREATE ON SCOTT.SCHEMA
    DECLARE
    tmp VARCHAR2(50);
    BEGIN
    dbms_output.put_line(ora_dict_obj_name);
    select object_id
    into tmp
    from dba_objects
    where object_name = ora_dict_obj_name;
    dbms_output.put_line(tmp);
    END;
    Error report:
    ORA-04088: Fout bij uitvoering van trigger 'SCOTT.TRG_TEST'.
    ORA-01403: Geen gegevens gevonden.
    ORA-06512: in regel 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    It's in dutch, so I'll have a go at translating:
    Error report:
    ORA-04088: Exception while executing trigger 'SCOTT.TRG_TEST'.
    ORA-01403: No data found
    ORA-06512: in rule 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    Does anyone have an idea of how I can accomplish what I'm trying to do here.. Or maybe something I'm doing wrong?
    Thanks in advance!
    Davy

    What is "ora_dict_obj_name" defined as?
    Another option might be to setup a DBMS_SCHEDULER job to run the following insert
    firstly though, create the following table ;
    create document_table as (select * from dba_objects where rownum < 1)and then setup a DBMS_SCHEDULER job to run the following:
    begin
      insert into document_table
      (select dbo.*
       from   dba_objects    dbo
             ,document_Table dtb
       where  dbo.Object_ID = dtb.Object_ID(+)
       and    dtb.Object_ID is null);
       commit;
       exception
        when others then
          rollback;
          -- log a message somewhere with the error, i.e. SQLERRM
    end;
    /Note, I specified all columns, but you'll probably specify explicitly which column you require, in which case the CREATE table would change as well.
    Then you won't have a need for any trigger, and can better manage when you want your documentation to be updated.
    Another option might be to use COMMENT, which can be used on tables, views, materialized views, but won't cover all objects
    to the extent you might want.
    SQL> desc emp2
    Name                                                                                                  
    EMPNO                                                                                                 
    JOB                                                                                                   
    START_DATE                                                                                            
    SAL                                                                                                   
    DEPT                                                                                                  
    END_DATE                                                                                              
    SQL> comment on column emp2.sal is 'Existing Salary of employee as paid at most recent month end';

  • Error -- No Such Trigger('when-button-pressed')

    Hi,
    I am getting the error ""No Such Trigger('when-button-pressed')"",
    when I am executing the code EXECUTE_TRIGGER( 'WHEN-BUTTON-PRESSED' );
    on some item(Key-Next-Item), although WHEN-BUTTON-PRESSED trigger exists.
    What could be the problem ?. It worked till yesterday, giving error from today, I havent
    changed any thing.
    Thanks in Advance
    Devender

    Steve's tip is the only good solution for this case.
    The problem in your case for example is:
    Let's say you have a block-trigger, which fires after your execute-trigger.
    Now a colleague of you, which don't know your code, create a WHEN-BUTTON-PRESSED on an item, then the new code is started and not the block-trigger-code.
    So, don't ever do this. Write your code in a package-function or -procedure and call it from the trigger. So you can re-user the functionality
    Gerd

  • Need help with create trigger based on more then 1 table and join.

    Hello,
    Here i have 3 tables
    1. Employee
    PERSON_ID
    1
    1
    N
    NUMBER
    None
    ORG_ID
    2
    N
    NUMBER
    Frequency
    LOC_ID
    3
    N
    NUMBER
    Frequency
    JOB_ID
    4
    Y
    NUMBER
    Height Balanced
    FLSA_STATUS_ID
    5
    Y
    NUMBER
    Frequency
    FULL_NAME
    6
    N
    VARCHAR2 (250 Byte)
    Height Balanced
    FIRST_NAME
    7
    N
    VARCHAR2 (20 Byte)
    Height Balanced
    MIDDLE_NAME
    8
    Y
    VARCHAR2 (60 Byte)
    Height Balanced
    LAST_NAME
    9
    N
    VARCHAR2 (40 Byte)
    Height Balanced
    PREFERRED_NAME
    10
    Y
    VARCHAR2 (80 Byte)
    None
    EMAIL
    11
    Y
    VARCHAR2 (250 Byte)
    None
    MAILSTOP
    12
    Y
    VARCHAR2 (100 Byte)
    None
    HIRE_DATE
    13
    N
    DATE
    None
    2. ems_candidate
    EMS_CANDIDATE_ID
    1
    1
    N
    NUMBER
    None
    EMS_JOB_ID
    2
    Y
    NUMBER
    Frequency
    NAME
    3
    N
    VARCHAR2 (255 Byte)
    Frequency
    EMAIL
    4
    Y
    VARCHAR2 (255 Byte)
    None
    TELEPHONE
    5
    Y
    VARCHAR2 (25 Byte)
    None
    EMS_SOURCE_ID
    6
    Y
    NUMBER
    Frequency
    RECEIVED_DATE
    7
    Y
    DATE
    Frequency
    COMMENTS
    8
    Y
    VARCHAR2 (4000 Byte)
    None
    3. employee_resources
    EMP_RES_ID
    1
    1
    N
    NUMBER
    None
    PERSON_ID
    2
    Y
    NUMBER
    Height Balanced
    CANDIDATE_ID
    3
    Y
    NUMBER
    Frequency
    EMP_START_DATE
    4
    Y
    DATE
    None
    CUSTOM_RESOURCE_FLAG
    5
    Y
    NUMBER (1)
    None
    RESOURCE_GROUP_ID
    6
    N
    NUMBER
    Frequency
    RESOURCE_STATUS_ID
    7
    N
    NUMBER
    Frequency
    GROUP_LOC_ID
    8
    N
    NUMBER
    Height Balanced
    ASSIGNED_JIRA
    9
    Y
    VARCHAR2 (250 Byte)
    None
    REVOKED_JIRA
    10
    Y
    VARCHAR2 (250 Byte)
    None
    CREATED_DATE
    11
    Y
    DATE
    SYSDATE
    None
    UPDATED_DATE
    12
    Y
    DATE
    None
    Now i want to create trigger when new record get inserted in employee table wanted to update person_id in employee_resources table.
    So i want to match ems_candidate.name with employee.full_name , ems_candidate.ems_job_id with employee.ems_job_id. And if it matched then update person_id in employee_resources table else through an exception and insert record in temp table.
    If anybody has an idea can u please help me.
    Thanks,
    Gayatri.

    I created below trigger
    CREATE TRIGGER emp_resources_upd_person_id
    AFTER INSERT ON ems.employee
    FOR EACH ROW
    BEGIN
        UPDATE ems.employee_resources
           SET person_id = :new.person_id
         WHERE candidate_id = (SELECT ems_candidate_id  
                                 FROM ems.ems_candidate cand, ems.employee emp
                                WHERE TRIM(UPPER(emp.first_name)) = TRIM(UPPER(SUBSTR (cand.name, 1, INSTR (cand.name, ' ') - 1)))
                                  AND TRIM(UPPER(emp.last_name)) = TRIM(UPPER(SUBSTR (cand.name,INSTR (cand.name, ' ') + 1,DECODE (INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' '),0,LENGTH (cand.name),(INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' ') - 1)))))
                                  AND emp.person_id = :new.person_id);
    EXCEPTION
      WHEN OTHERS THEN
        INSERT INTO ems.update_person_id_exception(person_id,first_name,last_name,full_name) VALUES(:new.person_id,:new.first_name,:new.last_name,:new.full_name);
    END;
    Now when i am trying to insert row in ems.employee  table it gives me an error
    ORA-04091
    table string.string 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.
    Can anybody please help me to come out from these error.
    Thanks,
    Gayatri.

  • Please trace what is wrong in TRIGGER script , doesnt create trigger.

    Hi Oracle Gurus,
    Please help me, in finding what is wrong in trigger statement. It doesn not create trigger, instead it displays line numbers..like 1 2 3 4 ....after pressing the enter key,
    I am attaching the full script, where it alters table, then creates new table, the creates sequence..lastly it fails in creating the trigger.
    ==================================================================================
    SQL> ALTER TABLE MOBILE.MOBILE_USER ADD (LAST_LOGIN TIMESTAMP);
    Table altered.
    SQL> CREATE TABLE "MOBILE"."AUDIT_LOG"
    2 3 "AUDIT_LOG_ID" NUMBER(16,0) NOT NULL ENABLE,
    4 "DATE_CREATED" TIMESTAMP (6) NOT NULL ENABLE,
    5 "AUDIT_TYPE" VARCHAR2(20 BYTE) NOT NULL ENABLE,
    6 "AUDIT_DATA" CLOB,
    7 CONSTRAINT "AUDIT_LOG_PK" PRIMARY KEY ("AUDIT_LOG_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "SERVICES_DATA" ENABLE
    8 )
    9 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    10 11 12 )
    TABLESPACE "SERVICES_DATA" LOB
    13 14 (
    15 "AUDIT_DATA"
    16 )
    17 STORE AS
    18 (
    19 TABLESPACE "SERVICES_DATA" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    20 ) ;
    Table created.
    SQL> CREATE SEQUENCE "MOBILE"."AUDIT_LOG_SEQ" INCREMENT BY 1 START WITH 1000 CACHE 20 NOCYCLE ;
    Sequence created.
    SQL> create or replace
    TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    SELECT AUDIT_LOG_SEQ.nextval
    INTO :NEW."AUDIT_LOG_ID"
    FROM dual;
    END IF;
    END IF;
    END;

    Ok great..but it gives the same error, we have already checked that AUDIT_LOG does exist.
    Is it checking something else..or it shoud be INSERT INTO instead of INSERT ON.
    Please help.
    create or replace
    TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    SELECT AUDIT_LOG_SEQ.nextval
    INTO :NEW."AUDIT_LOG_ID"
    FROM dual;
    END IF;
    END IF;
    END; /
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    ERROR at line 3:
    ORA-00942: table or view does not exist

  • Error in creating DLN on SAP 2007 01 PL07

    Hi Experts,
    Our profuct has been used by multi clients for years, and everything is working fine until one client upgrades to SAP 2007 01 PL07. The user was working properly at beginning, and got a error in creating DLN, then the user will not be able to create DLN any more, then the user has to logout and login the SAP to create DLN agian. the error will be trigger pretty often,and error msg is: the requested action is not support this object.
    the error is only hapened on one of our clients, and we struggled for long time, but could not fix it out.
    Any suggestion or recommandation will be more then welcome!
    Thank in advance.
    Austen

    You may check these:
    The requested action is not supported for this object
    Errors not listed in the documentation...

  • Getting error while creating Communication capability

    Hi,
    I am getting this error while creating communication capability of Host. I have successfully configured the TP communication capability. Even I have tried many times after changing the names given by me during configuration.
    Error creating Communication Capability
    java.lang.Exception : Error -: AIP-16012: Parameter: uri is unique for object Endpoint: Error -: AIP-11052: Writing following objects: Endpoint failed due to following constraint violation: ENDPOINT_UK. UNIQUE CONSTRAINT VIOLATION: java.sql.SQLException: ORA-20003: Endpoint_UK. Unique constraint violation ORA-06512: at "B2B.TRG_ENDPOINT_INS", line 17 ORA-01403: no data found ORA-04088: error during execution of trigger 'B2B.TRG_ENDPOINT_INS'
    Please tell me what is the source of error.
    Thanks in advance.
    Regards,
    Anuj Dwivedi

    Hi I am getting this error while creating communication capability --
    Error creating Communication Capability
    java.lang.Exception : Error -: AIP-16012: Parameter: trading Partner is unique for object Certificate: Error -: AIP-11052: Writing following objects: Certificate failed due to following constraint violation: CERTIFICATE_UK. UNIQUE CONSTRAINT VIOLATION: java.sql.SQLException: ORA-20003: Certificate_UK. Unique constraint violation ORA-06512: at "B2B.TRG_CERTIFICATE_INS", line 20 ORA-01403: no data found ORA-04088: error during execution of trigger 'B2B.TRG_CERTIFICATE_INS'
    Please tell that where could be the problem?
    Thanks.
    Regards.
    Anuj Dwivedi

Maybe you are looking for