Update trigger error

Hello,
I have this issue where I'm getting the following error when executing an update in a view. Insert command appears to be OK. Any idea on what am I missing?
ORA-01084: invalid argument in OCI call
ORA-06512: at "APPS.XXRVM_TEMP_B_UPD_TR", line 2
ORA-04088: error during execution of trigger 'APPS.XXRVM_TEMP_B_UPD_TR'
-- sample update statement:
update xxrvm_temp_b_v
set text1 = 'ddd'
where text1 = 'aaa'
Thanks,
Rownald
----- object definitions ----
-- Located in TEST1 Dbase
create table xxrvm_temp_b
(text1 varchar2(30)
,text2 varchar2(30)
-- Located in TEST2 Dbase
-- view definition based on table at dblink
create or replace force view xxrvm_temp_b_v
(pri_key, text1, text2) as select rowid pri_key, text1, text2 from xxrvm_temp_b@test1;
-- trigger definition for insert
create or replace trigger xxrvm_temp_b_ins_tr
instead of insert on xxrvm_temp_b_v referencing new as new old as old
for each row
begin
insert into xxrvm_temp_b@test1 (text1, text2)
values (:new.text1, :new.text2);
end;
-- trigger definition for update
create or replace trigger xxrvm_temp_b_upd_tr
instead of update on xxrvm_temp_b_v referencing new as new old as old
for each row
begin
update xxrvm_temp_b@test1
set text1 = :new.text1 ,text2 = :new.text2
where rowid = :new.pri_key;
end;

Hello:
Check if the update works if you re-write the on-update trigger as-- trigger definition for update
create or replace trigger xxrvm_temp_b_upd_tr
instead of update on xxrvm_temp_b_v referencing new as new old as old
for each row
begin
update xxrvm_temp_b@test1
set text1 = :new.text1 ,text2 = :new.text2
where text1=:old_text1 and text2=:old_text2
end;Varad

Similar Messages

  • Instead of Update Trigger error

    Hi all,
    I've been trying to solve this issue from past 4 to 5 days..I am unable to solve...Can someone please help....
    I hhave a requirement in which I need to update 4 tables from a single form...I created a view which will get the required fields along with the primary keys from all these 4 tables.
    Then I created a Instead of Update trigger as below
    CREATE OR REPLACE TRIGGER "HOMEPAGEVIEW_UPDATE"
    INSTEAD OF UPDATE ON cts_homepageview
    BEGIN
    DECLARE
    vID NUMBER;
    UPDATE cts_hardware_info
    SET STATUS_ID = :NEW.STATUS_ID,
    COMPUTER_NAME = :NEW.COMPUTER_NAME,
    OPERATINGSYSTEM_ID = :NEW.OPERATINGSYSTEM_ID
    where computer_id = :NEW.COMPUTER_ID;
    UPDATE cts_server_administrator
    SET PRIMARY_ADMIN_ID = :NEW.PRIMADMIN_ID,
    SECONDARY_ADMIN_ID = :NEW.SECONDADMIN_ID
    WHERE ID = :NEW.ID;
    UPDATE cts_location_info
    SET BUILDING_ROOM_RACK = :NEW.BUILDING_ROOM_RACK
    WHERE LOCATION_ID = :NEW.LOCATION_ID;
    UPDATE cts_maintenace_info
    SET MAINTENANCE_WINDOW = :NEW.MAINTENANCE_WINDOW
    WHERE MAINTENANCE_ID = :NEW.MAINTENANCE_ID;
    END;
    When I try to update a record, am gettting the following error
    ORA-20505: Error in DML: p_rowid=488, p_alt_rowid=COMPUTER_ID, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    Error Unable to process row of table CTS_HOMEPAGEVIEW.
    OK
    I have already posted this question on the forum, but dint get any replies so trying my luck again....Can someone plzzzzzz help...I searched on ths forum for similar requests...Found one post bt hte solution wasnt given...
    Thanks,
    Shravanthi
    Edited by: user0012 on Apr 29, 2009 9:54 AM

    Hi Varad and Andy,
    Thank you both for your responses first..I was soo tensed since no one replied to my previous post fr 5 days..
    Varad,
    With the change Andy told ('Begin & END'), I tried in SQL Workshop updated computer_name (of cts_hardware_info) data in the view..It updated the data. But from the form, it is still giving the same error.
    Andy,
    Here is my view.. All the table are associated with the cts_hardware_info using computer_id. And using this computer_id I have put all the data together.
    CREATE OR REPLACE FORCE VIEW "CTS_HOMEPAGEVIEW" ("COMPUTER_ID", "COMPUTER_NAME", "STATUS_ID", "DESCRIPTION", "OPERATINGSYSTEM_ID", "ID", "PRIMADMIN_ID", "PRIMARYADMIN_PHONE1", "SECONDADMIN_ID", "SECONDARYADMIN_PHONE1", "LOCATION_ID", "BUILDING_ROOM_RACK", "MAINTENANCE_ID", "MAINTENANCE_WINDOW") AS
    select g.computer_id,g.computer_name,g.status_id,cts_hardware_status.DESCRIPTION,g.operatingsystem_id,g.id,g.PrimAdmin_ID,g.PrimaryAdmin_Phone1,g.SecondAdmin_ID, g.SecondaryAdmin_PHONE1,g.location_id,g.BUILDING_ROOM_RACK,g.MAINTENANCE_ID,g.MAINTENANCE_WINDOW from
    (select e.computer_id,e.computer_name,e.status_id,e.operatingsystem_id,e.id,e.PrimAdmin_ID,e.PrimaryAdmin_Phone1,e.SecondAdmin_ID,e.SecondaryAdmin_PHONE1,
    e.location_id,e.BUILDING_ROOM_RACK,f.MAINTENANCE_ID,f.MAINTENANCE_WINDOW from
    (select c.computer_id,c.computer_name,c.status_id,c.operatingsystem_id,c.id,c.PrimAdmin_ID,c.PrimaryAdmin_Phone1,c.SecondAdmin_ID,c.SecondaryAdmin_PHONE1,
    d.location_id,d.BUILDING_ROOM_RACK from
    (select a.computer_id,a.computer_name,a.status_id,a.operatingsystem_id,b.id,b.PrimAdmin_ID,b.PrimaryAdmin_Phone1,b.SecondAdmin_ID,b.SecondaryAdmin_PHONE1 from
    (select cts_hardware_info.computer_id,cts_hardware_info.computer_name,cts_hardware_info.status_id,operatingsystem_id from cts_hardware_info) a
    left join
    (select cts_server_administrator.id,cts_server_administrator.computer_id,cts_administrator_contacts.ADMIN_id as PrimAdmin_ID,Phone1 as PrimaryAdmin_Phone1,
    (select ADMIN_id from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondAdmin_ID,
    (select Phone1 from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondaryAdmin_PHONE1
    from cts_server_administrator,cts_administrator_contacts where cts_administrator_contacts.admin_id = cts_server_administrator.PRIMARY_ADMIN_ID) b
    on a.computer_id = b.computer_id) c
    left join
    (select location_id,COMPUTER_ID,BUILDING_ROOM_RACK from cts_location_info) d
    on c.computer_id = d.computer_id) e
    left join
    (select MAINTENANCE_ID,COMPUTER_ID,MAINTENANCE_WINDOW from CTS_MAINTENACE_INFO) f
    on e.computer_id = f.computer_id) g left join cts_hardware_status on g.status_id = cts_hardware_status.STATUS_ID

  • Insert/Update Trigger error

    Hi all,
    What is wrong with my code?
    SQL> create or replace trigger interval_after_tr
    after insert or update on intervals
    for each row
    begin
    if ((:new.beginning) > (:new.ending)) then
    RAISE_APPLICATION_ERROR(-20061,’BEGINNING VALUE > ENDING VALUE IN THE SAME ROW’);
    elsif ((:new.ending) < (interval_package.pac_ending)) or ((:new.ending) <> (interval_package.pac_beginning))
    RAISE_APPLICATION_ERROR(-20061,’ENDING VALUE IS < ANY ENDING VALUE OR <> ANY OTHER BEGINNING VALUE’);
    elsif ((:new.beginning) > (interval_package.pac_beginning)) or ((:new.beginning) <> (interval_package.pac_ending))
    RAISE_APPLICATION_ERROR(-20061,’BEGINNING VALUE IS > ANY BEGINNING VALUE OR <> ANY OTHER ENDING VALUE’);
    else
    RAISE_APPLICATION_ERROR(-20061,’INSERTED BEGINNING/ENDING VALUE IS INVALID’);
    end if;
    end ;
    Trigger created.
    SQL> show err
    Errors for TRIGGER INTERVAL_AFTER_TR:
    LINE/COL ERROR
    3/42 PLS-00103: Encountered the symbol "?" when expecting one of the
    following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set
    specification>
    <an alternatively-q
    Kindly help!
    Regards,
    S.

    Try:
    CREATE OR REPLACE TRIGGER interval_after_tr
    AFTER INSERT OR UPDATE
    ON intervals
    FOR EACH ROW
    BEGIN
    IF ((:NEW.beginning) > (:NEW.ending))
    THEN
    raise_application_error
    (-20061,
    'BEGINNING VALUE > ENDING VALUE IN THE SAME ROW'
    ELSIF ((:NEW.ending) < (interval_package.pac_ending))
    OR ((:NEW.ending) <> (interval_package.pac_beginning))
    THEN
    raise_application_error
    (-20061,
    'ENDING VALUE IS < ANY ENDING VALUE OR <> ANY OTHER BEGINNING VALUE'
    ELSIF ((:NEW.beginning) > (interval_package.pac_beginning))
    OR ((:NEW.beginning) <> (interval_package.pac_ending))
    THEN
    raise_application_error
    (-20061,
    'BEGINNING VALUE IS > ANY BEGINNING VALUE OR <> ANY OTHER ENDING VALUE'
    ELSE
    raise_application_error (-20061,
    'INSERTED BEGINNING/ENDING VALUE IS INVALID'
    END IF;
    END;
    /

  • Mutating Trigger error while updating table

    Hi Guys,
    I am updating one table and after trigger also fire at the same time. Now, I want to avoid mutating trigger error. Can any one help me on this.
    Thanks in advance!
    Regards,
    -LRK

    You'll have to read these articles first, they explain what's the problem and how to deal with it:
    http://www.oracle-base.com/articles/9i/MutatingTableExceptions.php
    http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936
    but, as Saubhik already said, using Oracle's AUDIT functionality would be the way to go.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4007.htm
    Using an autonomous transaction can result in corrupted data or unexpected errors, stay away from them if you want to use them in order to bypass/hide your mutating table error.

  • Update trigger fails with value too large for column error on timestamp

    Hello there,
    I've got a problem with several update triggers. I've several triggers monitoring a set of tables.
    Upon each update the updated data is compared with the current values in the table columns.
    If different values are detected the update timestamp is set with the current_timestamp. That
    way we have a timestamp that reflects real changes in relevant data. I attached an example for
    that kind of trigger below. The triggers on each monitored table only differ in the columns that
    are compared.
    CREATE OR REPLACE TRIGGER T_ava01_obj_cont
    BEFORE UPDATE on ava01_obj_cont
    FOR EACH ROW
    DECLARE
      v_changed  boolean := false;
    BEGIN
      IF NOT v_changed THEN
        v_changed := (:old.cr_adv_id IS NULL AND :new.cr_adv_id IS NOT NULL) OR
                     (:old.cr_adv_id IS NOT NULL AND :new.cr_adv_id IS NULL)OR
                     (:old.cr_adv_id IS NOT NULL AND :new.cr_adv_id IS NOT NULL AND :old.cr_adv_id != :new.cr_adv_id);
      END IF;
      IF NOT v_changed THEN
        v_changed := (:old.is_euzins_relevant IS NULL AND :new.is_euzins_relevant IS NOT NULL) OR
                     (:old.is_euzins_relevant IS NOT NULL AND :new.is_euzins_relevant IS NULL)OR
                     (:old.is_euzins_relevant IS NOT NULL AND :new.is_euzins_relevant IS NOT NULL AND :old.is_euzins_relevant != :new.is_euzins_relevant);
      END IF;
    [.. more values being compared ..]
        IF v_changed THEN
        :new.update_ts := current_timestamp;
      END IF;
    END T_ava01_obj_cont;Really relevant is the statement
    :new.update_ts := current_timestamp;So far so good. The problem is, it works the most of time. Only sometimes it fails with the following error:
    SQL state [72000]; error code [12899]; ORA-12899: value too large for column "LGT_CLASS_AVALOQ"."AVA01_OBJ_CONT"."UPDATE_TS"
    (actual: 28, maximum: 11)
    I can't see how the value systimestamp or current_timestamp (I tried both) should be too large for
    a column defined as TIMESTAMP(6). We've got tables where more updates occur then elsewhere.
    Thats where the most of the errors pop up. Other tables with fewer updates show errors only
    sporadicly or even never. I can't see a kind of error pattern. It's like that every 10.000th update
    or less failes.
    I was desperate enough to try some language dependend transformation like
    IF v_changed THEN
        l_update_date := systimestamp || '';
        select value into l_timestamp_format from nls_database_parameters where parameter = 'NLS_TIMESTAMP_TZ_FORMAT';
        :new.update_ts := to_timestamp_tz(l_update_date, l_timestamp_format);
    END IF;to be sure the format is right. It didn't change a thing.
    We are using Oracle Version 10.2.0.4.0 Production.
    Did anyone encounter that kind of behaviour and solve it? I'm now pretty certain that it has to
    be an oracle bug. What is the forum's opinion on that? Would you suggest to file a bug report?
    Thanks in advance for your help.
    Kind regards
    Jan

    Could you please edit your post and use formatting and tags.  This is pretty much unreadable and the forum boogered up some of your code.
    Instructions are here: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Mutating error : row level BEFORE UPDATE trigger

    Hi,
    I had an issue on mutating terror(was trying to write a row level BEFORE update trigger), however i got it resolved after refering tom kytes web site. I thought i would share it with everyone, might be helpful for a few... Thanks!
    I will be more than happy to learn on further better ways of resolving this issue.
    Below I have posted the trigger that was causing this error and the work around for that issue, I created a package and three other triggers to replace row level BEFORE update trigger:
    ++trigger that was causing this issue:++
    CREATE OR REPLACE TRIGGER C_F_BI
    BEFORE INSERT ON CONTACT_FUNCTION FOR EACH ROW
    declare
    cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
    cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type)
    is
    select
    cft.function_type_code,
    cft.multiples_permitted
    from
    CONTACT_FUNCTION cf,
    CONTACT c,
    CONTACT_FUNCTION_TYPE cft
    where
    c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
    and c.contact_id = cf.contact_id
    and cf.function_type_code = cft.function_type_code
    and cft.function_type_code = cur_function_type_code;
    v_function_type_code contact_function_type.function_type_code%type;
    v_multiples_permitted contact_function_type.multiples_permitted%type;
    E_Multiples_Not_Permitted Exception;
    begin
    if not function_code_cur%isopen then
    open function_code_cur(:new.contact_Id,:new.function_type_code);
    end if;
    loop
    fetch function_code_cur into v_function_type_code, v_multiples_permitted;
    exit when not function_code_cur%found;
    end loop;
    ** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
    if v_multiples_permitted = 'N' then
    raise E_Multiples_Not_Permitted;
    end if;
    close function_code_cur;
    EXCEPTION
    when E_Multiples_Not_Permitted then
    raise_application_error( -20001,'Multiples not allowed for function type ' ||
    v_function_type_code || '. sqlerrm - ' || sqlerrm );
    when others then
    raise;
    end;
    ++solution for above issue :++
    create or replace package state_pkg
    is
    type ridArray_rec is record(rid rowid, cont_id number, cont_fn_type varchar2(20));
    type ridArray is table of ridArray_rec index by binary_integer;
    newRows ridArray;
    empty ridArray;
    end state_pkg;
    create or replace trigger contact_function_bu1
    before update on contact_function
    begin
    state_pkg.newRows := state_pkg.empty;
    end;
    create or replace trigger contact_function_bu2
    before update ON CONTACT_FUNCTION FOR EACH ROW
    DECLARE
    I NUMBER:=0;
    begin
    I := state_pkg.newRows.count+1;
    state_pkg.newRows( I ).rid := :new.rowid;
    state_pkg.newRows( I ).cont_id := :new.contact_id;
    state_pkg.newRows( I ).cont_fn_type := :new.function_type_code;
    end;
    create or replace trigger contact_function_bu
    after update ON CONTACT_FUNCTION
    declare
    cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
    cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type,
    rid2 rowid)
    is
    select
    cft.function_type_code,
    cft.multiples_permitted
    from
    CONTACT_FUNCTION cf,
    CONTACT c,
    CONTACT_FUNCTION_TYPE cft
    where
    c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
    and c.contact_id = cf.contact_id
    and cf.function_type_code = cft.function_type_code
    and cft.function_type_code = cur_function_type_code
    and cf.rowid = rid2;
    v_function_type_code contact_function_type.function_type_code%type;
    v_multiples_permitted contact_function_type.multiples_permitted%type;
    E_Multiples_Not_Permitted Exception;
    begin
    for i in 1 .. state_pkg.newRows.count loop
    if not function_code_cur%isopen then
    open function_code_cur(state_pkg.newRows(i).cont_id, state_pkg.newRows(i).cont_fn_type, state_pkg.newRows(i).rid);
    end if;
    loop
    fetch function_code_cur into v_function_type_code, v_multiples_permitted;
    exit when not function_code_cur%found;
    end loop;
    ** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
    if v_multiples_permitted = 'N' then
    raise E_Multiples_Not_Permitted;
    end if;
    close function_code_cur;
    end loop;
    EXCEPTION
    when E_Multiples_Not_Permitted then
    raise_application_error( -20001,'Multiples not allowed for function type ' ||
    v_function_type_code || '. sqlerrm - ' || sqlerrm );
    when others then
    raise;
    end;
    /

    It seems you could have solved the issue otherwise:
    CREATE OR REPLACE TRIGGER c_f_bi
       BEFORE INSERT
       ON contact_function
       FOR EACH ROW
    DECLARE
       v_function_type_code        contact_function_type.function_type_code%TYPE;
       v_multiples_permitted       contact_function_type.multiples_permitted%TYPE;
       e_multiples_not_permitted   EXCEPTION;
    BEGIN
       BEGIN
          SELECT cft.function_type_code, cft.multiples_permitted
            INTO v_function_type_code, v_multiples_permitted
            FROM contact c, contact_function_type cft
           WHERE c.acct_id = (SELECT acct_id
                                FROM contact
                               WHERE contact_id = :NEW.contact_id)
             AND c.contact_id = :NEW.contact_id
             AND cft.function_type_code = :NEW.function_type_code;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             v_function_type_code := :NEW.function_type_code;
             v_multiples_permitted := '?';
       END;
    ** if the query returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
       IF v_multiples_permitted = 'N'
       THEN
          RAISE e_multiples_not_permitted;
       END IF;
    EXCEPTION
       WHEN e_multiples_not_permitted
       THEN
          raise_application_error (-20001,
                                      'Multiples not allowed for function type '
                                   || v_function_type_code
                                   || '. sqlerrm - '
                                   || SQLERRM
       WHEN OTHERS
       THEN
          RAISE;
    END;
    /:p

  • DB Trigger error - Updating same table in the trigger script

    Hi All,
    I have a table tab1, when ever any update is done on this table on column col1 then col2 also need to get update.(These are linked to forms so user can update only col1 from form frontend)
    so I created a trigger as follows.
    CREATE OR REPLACE TRIGGER tri1
    AFTER UPDATE
    ON tab1
    FOR EACH ROW
    WHEN (NEW.col1 = 'YES')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    UPDATE tab1 SET col2= 1
    WHERE transaction_id = :OLD.transaction_id;
    COMMIT;
    END;
    When there is any update on this table I get following error. Please let me know if I miss any thing.
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at "user1.tab1", line 5
    ORA-04088: error during execution of trigger 'user1.tab1'
    Please let me know if I am not clear. Thanks
    Edited by: DharV on Aug 23, 2011 5:17 AM

    Is your transaction_id unique?
    If that is the case then you could perhaps use BEFORE UPDATE instead of AFTER UPDATE:
    CREATE OR REPLACE TRIGGER tri1
    BEFORE UPDATE
    ON tab1
    FOR EACH ROW
    WHEN (NEW.col1 = 'YES')
    BEGIN
       :NEW.col2 := 1;
    END;If your transaction_id is not unique - so you really want to update more than one row in tab1 - your update cannot update the same row as the trigger reacted upon, even with the use of autonomous transaction. Then you could combine the above BEFORE UPDATE trigger with your own AFTER UPDATE, but then add ROWID != :OLD.ROWID to the where clause, but it would be a bad idea because some of your rows will be updated in one transaction and others in another transaction.
    In general autonomous transaction is not a great way to solve mutating table problem in a trigger. Hopefully you have a unique transaction_id and can do BEFORE UPDATE - if not then a better way is to save the id's to be updated in a package array in the FOR EACH ROW triggers, and then do a AFTER UPDATE trigger that is NOT "for each row" to update the list of saved id's.

  • FRM-40735 POST- UPDATE trigger raised unhandled exception ORA- 01403

    FRM-40735 POST- UPDATE trigger raised unhandled exception ORA- 01403
    I am getting the above error when i am trying to change the Assignment Category field of
    an employee from Junior Staff to Senior Staff.
    Navigation People> Enter & Maintain> (B)Assignment.
    Kindly assist me to resolve this error.
    Plz note there is a promotion that is suppose to be given to some employees in our company as of
    01-APR-2010 so i had to open the closed payroll periods and do the changes. I managed to change for all
    the 9 employees but 1 employee's assignment is giving me an error as follows :
    FRM-40735 POST- UPDATE trigger raised unhandled exception ORA- 01403
    The error displays after i try to save the changes made to the Assignment Category from Junior Staff to Senior Staff.
    NB: i have also tried to switch off the custom code...but its giving me same error.
    Also the element links have been defined for employment category on the links window.
    please help!!
    Edited by: 594647 on Jul 20, 2010 10:26 PM

    Release 12.1.1.
    OS is Red Hat Ent Ed 4
    i am trying to change the employee assignment category from Junior to Senior. so when i am updating the assignment details on the assignment screen (Navigation is People >Enter & Maintain> Assignment) and trying to save, the system gives error on the status bar of the application as follows:
    FRM-40735 POST- UPDATE trigger raised unhandled exception ORA- 01403
    NB: Error is appearing on the Assignment screen.
    Please help!!
    Edited by: 594647 on Jul 21, 2010 2:48 PM

  • Global temp table trigger error on Oracle AS

    we have a set of triggers that load a temp table in the before delete,update and process the table in an after statement trigger. the data that's loaded is a complaintid and when the complaintid is selected into a variable in the after statement, a No data found error is fired. This only happens on Oracle AS both 9i and 10g, it does not happen on jboss. All the app servers use connection pooling and they are 9i Enterprise Edition Dedicated database servers.
    Is it possible that there is a bug in Oracle AS that allows multiple sessions to affect the same global variables ?
    Sorry it's a long one, but I wanted to include everything I could
    table creation script.
    CREATE GLOBAL TEMPORARY TABLE TEMPEVENTS
    (     COMPLAINTID VARCHAR2(20) NOT NULL ENABLE,
         COMPLAINTEVENTID NUMBER NOT NULL ENABLE,
         STARTDATE DATE,
         EVENTTYPE NUMBER,
         EVENTSUBTYPE NUMBER,
         DELETED NUMBER
    ) ON COMMIT DELETE ROWS
    Before update trigger-- as a test I saved the data in a permanent table and all columns have usable values.
    create or replace trigger BeforeUpdateReportDataROW
    BEFORE Delete or Update of deleted, startdate on complaintevents
    FOR EACH ROW
    BEGIN
    IF (DELETING AND :old.deleted = 0) OR (UPDATING AND :new.deleted=1 AND :old.startDate = :new.startDate) THEN
         TEMPDATA.v_triggerType := 'D';
    ELSIF UPDATING AND :old.deleted=1 AND :old.startDate = :new.startDate THEN /*undeleting*/
         TEMPDATA.v_triggerType := 'U';
    ELSIF UPDATING AND :old.startDate != :new.startDate THEN /*new date*/
         TEMPDATA.v_triggerType := 'S';
    ELSE
         TEMPDATA.v_triggerType := 'N';
    END IF;
    TEMPDATA.v_NumEntries := TEMPDATA.v_NumEntries + 1;
    TEMPDATA.v_complaintids(TEMPDATA.v_NumEntries) := :old.complaintid;
    TEMPDATA.v_complainteventids(TEMPDATA.v_NumEntries) := :old.complainteventid;
    END;
    After statement trigger -- the error happens on the
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    statement. this is all one transaction the complaintid is loaded from the complaintevent table, and is not a primary key, nor is there only one record in the complaintevent table for each complaintid.
    create or replace trigger complaintevents_del_upd_trig
    AFTER DELETE OR UPDATE OF deleted, startdate
    ON complaintevents
    DECLARE
    complaintid VARCHAR2 (20);
    loop_index NUMBER;
    hold_complaintid VARCHAR2 (20);
    BEGIN
    IF tempdata.v_triggertype = 'D'
    THEN /*deleting event*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE complainteventid =
    tempdata.v_complainteventids (loop_index)
    OR deleted = 1;
    hold_complaintid := complaintid;
    END LOOP;
    ELSIF tempdata.v_triggertype = 'U'
    THEN /*undeleting*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE deleted = 1;
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, 0
    FROM complaintevents
    WHERE complainteventid =
    tempdata.v_complainteventids (loop_index);
    hold_complaintid := complaintid;
    END LOOP;
    ELSIF tempdata.v_triggertype = 'S'
    THEN /*date change*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE deleted = 1;
    hold_complaintid := complaintid;
    END LOOP;
    ELSE
    RETURN;
    END IF;
    END;

    CREATE GLOBAL TEMPORARY TABLE test_glb ON COMMIT DELETE ROWS
    AS SELECT * FROM test1;btw I'm assuming you are just using the SELECT statement to copy the definition of test1. Since DDL statements commit, there will be no rows in test_glb after creating it.
    Edited by: William Robertson on Feb 23, 2009 7:31 AM

  • Error in Action when CRM Order is updated as Error from R/3 update

    Hi,
    Currently we are in CRM 6.0 SP04 and R/3 4.7 SP14
    Process:
    1) B2B user places order through ISA
    2) Order gets replicated R/3 from CRM through middleware (Scenario A setting)
    3) If there are any changes in order on either side, changes gets replicated.
    Requirement:
    We have a requirement from business to trigger workflow in CRM if order is in error. Following are the possible scenarios
    1) Error while saving order in CRM
    2) No errors in CRM. However, Order will get error in R/3 because of inconsistent configuration or master data between CRM and R/3. The BDOC will be green while replicating to R/3 and acknowledgement to CRM.
    3) BDOC status is in error
    Solution approach:
    We created an action to trigger event when order status set to "Contains error". The condition for Action trigger are Order have error free flag NE X(BUS 2000115 )  OR Status = I1030 OR status = I1056.
    Issues:
    1)     Scenario : Order is successfully create in CRM without any error. Order gets replicated to R/3 u2013 BDOC is green. However, the order gets error status in R/3 because of inconsistent configuration or master data. The acknowledgement BDOC updates the error status in CRM. However, Action does not get trigger when the order is updated as Error from R/3.
    Pls advise possible solution and also suggest any other way to achieve the required functionality to generate workflow for CRM order updated as Error from R/3.
    Regards,
    Anil Rithe

    Hi Anil,
    Try this, implement ORDER_SAVE BAdI.  This BAdI is triggered every time an order is saved, you could put in your logic to see if the order has errors, if yes trigger your workflow.
    I haven't tested but this should work for your case when the crm order is set to error status after the replication to R/3(the BDOC scenario).
    This may not be the most efficient method of doing, but this would definitely work.
    Make sure you use proper checks at the beginning  of your order_save BAdI implementation as this badi would get executed on save of every 1-order object.
    ~Kiran

  • Instead of Trigger Error

    Hi ALL,
    I am trying to create INSTEAD OF trigger on the existing VIEW, but I getting error as:-
    Not found
    The requested URL /apex/wwv_flow.show was not found on this server
    I'm creating trigger as :-
    CREATE OR REPLACE TRIGGER "trigger_name"
    INSTEAD OF UPDATE ON "view_name"
    FOR EACH ROW
    BEGIN
    UPDATE query;
    UPDATE query;
    END;
    but when I'm writting only one update query rather two update queires in the above trigger, it is creating but not with two update queries.
    Also I created another INSTEAD OF trigger on the same View as:-
    CREATE OR REPLACE TRIGGER "trigger_name"
    INSTEAD OF INSERT ON "view_name"
    FOR EACH ROW
    BEGIN
    INSERT query;
    INSERT query;
    END;
    this trigger is created without any errors than why INSTEAD OF(FOR UPDATE) trigger is not creating.... can anybody help me out with this issue.....
    thxs
    regards,
    Kumar

    Hi again,
    everything is working very much fine(I mean instead of trigger with update as well as with insert) when I'm creating on apex workspace.... this is the issue with my development enviornment.... so this is the problem with development DB or something else?????
    thxs
    regards,
    Kumar

  • How can you create a simple insert or update trigger

    I am trying to create a simple insert or update trigger to timestamp an xml document when I load it into my XML DB repository but I always get an error trying to compile the trigger.
    "ORA-25003: cannot change NEW values for this column type in trigger"
    Here is my PL/SQL:
    CREATE OR REPLACE TRIGGER "PLCSYSADM"."PLCSYSLOG_TIMESTAMP"
    BEFORE
    INSERT
    OR UPDATE ON "PLCSYSADM"."PLCSYSLOG"
    FOR EACH ROW BEGIN
    :new.sys_nc_rowinfo$ := xmltype('<datestamp>' || SYSDATE || '</datestamp>');
    END;
    Does anyone have an example that works ?
    Thanks in advance
    Niels Montanana

    http://developer.apple.com/referencelibrary/HardwareDrivers/idxUSB-date.html

  • Before Update Trigger has mutating problem

    I'm getting a mutating problem with this updating trigger. I'm not sure how to deal with it. Here is my code:
    CREATE OR REPLACE TRIGGER WTL_SMP_TRG2
    BEFORE UPDATE ON WTL_SAMPLES
    FOR EACH ROW
    DECLARE
         sampleCount NUMBER(1) := 0;
         dupLabSampleID NUMBER(8) := 0;
    BEGIN
         SELECT COUNT(sample_ID)
         INTO sampleCount
         FROM wtl_samples
    WHERE jb_job_id = :new.jb_job_id
    AND lab_no = :new.lab_no
         AND sample_ID != :old.sample_ID;
         IF sampleCount > 0 THEN
         SELECT sample_ID
         INTO dupLabSampleID
         FROM wtl_samples
         WHERE jb_job_id = :new.jb_job_id
         AND lab_no = :new.lab_no
              AND sample_ID != :old.sample_ID;
    RAISE_APPLICATION_ERROR(-20501, 'Update failed, Lab Number ' || :new.lab_no || ' is used by SampleID: ' || dupLabSampleID);
    END IF;
    --EXCEPTION
    --     WHEN OTHERS THEN
    -- RAISE_APPLICATION_ERROR(-20901, 'Error in WTL_SMP_TRG2.');
    END WTL_SMP_TRG2;
    any help appreciated
    adam

    I guess I couldve done that, but was using design editor and didn't know how to put a unique constraint in. Is the problem only because I'm referencing the :old.sample_ID, or the :new values as well? If it's just the :old value I could write a before update statement trigger to place the sample_id into a package varaible and then call that variable up in the row level trigger.... i've tried this, but don't know how to pull the sample_id value i need in the before statement trigger... i'll supply the code i've done so far...
    CREATE OR REPLACE TRIGGER WTL_SMP_TRG2_INIT
    BEFORE UPDATE ON WTL_SAMPLES
    DECLARE
    BEGIN
         wtl_trg_custom_pkg.oldSampleID := sample_id; /* Doesn't know sample_id...? */
    END WTL_SMP_TRG2_INIT;

  • Update trigger syntax for multiple collumn update

    Hi
    I would like to create an update trigger that updates 3 collumns in another table.
    This works for one collumn:
    CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
    BEFORE UPDATE
    ON DBNAME.DB_EVENTS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    BEGIN
    UPDATE DB_EVENT_LOG ELOG
    SET
    COMPLETION_EVENT = :NEW.COMPLETION_EVENT
         WHERE :OLD.RECORD_ID = ELOG.RECORD_ID ;
    EXCEPTION
    WHEN OTHERS THEN
    -- log the error and re-raise
    RAISE;
    END ;
    but this does not work for multiple collumns:
    CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
    BEFORE UPDATE
    ON DBNAME.DB_EVENTS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    BEGIN
    UPDATE DB_EVENT_LOG ELOG
    SET
    (COMPLETION_EVENT
    , COMPLETION_DT_TM
    , COMPLETED_BY)
    =
    (:NEW.COMPLETION_EVENT
    , :NEW.COMPLETION_DT_TM
    , :NEW.COMPLETED_BY)
         WHERE :OLD.RECORD_ID = ELOG.RECORD_ID ;
    EXCEPTION
    WHEN OTHERS THEN
    -- log the error and re-raise
    RAISE;
    END ;
    What am i doing wrong?

    Try selecting from DUAL:
    SQL> CREATE TABLE emp_test AS SELECT * FROM emp
    Table created.
    SQL> CREATE OR REPLACE TRIGGER emp_trg
       AFTER UPDATE
       ON emp
       FOR EACH ROW
    BEGIN
       UPDATE emp_test
          SET (sal, comm) = (SELECT :NEW.sal,
                                    :NEW.comm
                               FROM DUAL)
        WHERE empno = :NEW.empno;
    END;
    Trigger created.
    SQL> UPDATE emp
       SET sal = 5000,
           comm = 5000
    WHERE empno = 7369
    1 row updated.
    SQL> SELECT empno,
           sal,
           comm
      FROM emp_test
    WHERE empno = 7369
         EMPNO        SAL       COMM
          7369       5000       5000

  • Help on creating update trigger(urgent)

    Hii all,
    I have a situation like this
    I have 10 different tables like a,b,c,d,e,f
    But i have same columns in all tables
    like
    updated_by,
    updated_date
    I need to create a procedure and call that procedure in update triggers for all tables
    Can anybody help
    In creating Procedure and trigger
    Thanks

    There is nothing wrong with the trigger, but the procedure is another story. You cannot do DML on the table that is firing the trigger inside the trigger, that is the mutating table error.
    I am not really sure why you are doing the DML anyway. you have defined a BEFORE UPDATE trigger on k_constituent, and the procedure checks for the existence of a row in the same table where the currt_user_id field is the same as the id of the user making the update. Without knowing anything about the application, this implies one of two things to me. Either you are trying to make sure the row to be updated does exist, or, this is some kind of security check.
    If it is the first, then it is unneccessary, since the before update trigger will only fire if the row to be updated exists viz.
    SQL> CREATE OR REPLACE TRIGGER jt_bu
      2  BEFORE UPDATE ON JTEST
      3  FOR EACH ROW
      4
      5  BEGIN
      6     :new.updby := USER;
      7     :new.updon := SYSDATE;
      8     DBMS_OUTPUT.Put_Line('Trigger fired ok');
      9  END;
    10  /
    Trigger created.
    SQL> SELECT * FROM jtest;
            ID DESCR      UPDBY                     UPDON
             1 YES        OPS$ORACLE                24-APR-03
             2 NEWDES     OPS$ORACLE                23-APR-03
             3 ORACLE     OPS$ORACLE                23-APR-03
    SQL> UPDATE jtest SET descr = 'NO' WHERE id = 1;
    Trigger fired ok
    1 row updated.
    SQL>  UPDATE jtest SET descr = 'NO' WHERE id = 5;
    0 rows updated.If you are doing this for security, then you are way too late. The user should not be in the database doing updates if they are not a valid user (whatever valid user means to you).
    As a side note, you do realize that if there is more than one record in k_constituent with currt_user_id = updating user, then the procedure will not set update_date and update_by?
    TTFN
    John

Maybe you are looking for

  • Not reading CD/DVD's, I need to format my computer!

    I have a Satellite P-100 PSPA3C-SD30E bought in CANADA in 2006 Its Pentium dual core T2400 / 1gb ram / has an ATI Radeon 512 mb / DVD-RAM Super-Multi / 100 gb disk/ running on windows XP SP 3 I´m trying to format the hard disk. So I need the use the

  • What is the best qay to create a simple page with three textbox fields

    Hi I try to create a Portal page for Password change. At first look, I taught that to create that basic page will be easy as one, two , three. Unfortunately not. I need to create three textbox and include pl/sql validation agains our BD. I usually wo

  • Two ipods and one itune

    Hello, I have two ipods but just one itunes. I can´t add music for one of my ipod´s. The itune recognize just one. What i have to do? Thank you!

  • IO 229 - Batch for serial number 1234 (BBB) differs from document batch AAA

    Hello All, We use batch management for serialized materials only at our central plant. For all other plants, there is no batch control. Sometimes we need to return materials back to the central plant but with a different batch number. When we do two

  • Supplier Summary Page extension

    Hello All, I am a Newbie to OAF development, I need to extend the Suppliers page (/oracle/apps/pos/supplier/webui/QuickUpdatePG ) to selective display the left side menu options like (purchasing,receiving,accounting) based on the responsibility used