Action of trigger to create records in table - how enusre parent commits

Hi,
Using oracle 11.2.0.3 and wish to do the following.
Have trigger on table a on database a.
When a record is inserted into table a a record should be written first to table1 on database b , committed then a record written to table2 on database b
as table2 has fk dependency on table 1.
How can we best achieve this.
Getting problems with the commit inside the trigger have tried pragma autonous transaction as well.
Get ora-02064 distributed transaction not supported when use the following code
create or replace trigger por_TRG_POP_IKNOW_MULTIPLE2
after INSERT OR UPDATE or delete   on por_MULTIPLE
for each row
-- tO ENSURE I-KNOW KEPT UP-TO-DATE WITH HOMIS MULTIPLE
-- delib not delet form i-know as if has been used by customer cannot delete
-- due to referential inetgrity constraints in i-know
-- Note parent_num updated on IKW via support.maintain_latest_dim_version.update_multiple until
-- When IKW becomes master of multiple info, this trigger can be removed
-- and support.maintain_latest_dim_version.update_multiple removed
declare
  PRAGMA AUTONOMOUS_TRANSACTION;
v_dml_type varchar2(1);
begin
   IF INSERTING OR UPDATING
   THEN
MERGE INTO [email protected] a
      USING
       select
       :new.MULT_LINK_MULTIPLE_CODE MULT_LINK_MULTIPLE_num
       multiple2.mult_name
       from dual, por_multiple multiple2
       where :new.MULT_LINK_MULTIPLE_CODE = multiple2.mult_multiple_code
       ) b
    on
       b.mult_link_multiple_NUM = a.mgrp_NUM
--when matched THEN update set
--      a.MGRP_NUM b.mult_link_multiple_num,
--      MGRP_DESCRIPTION = (select mult_name from por_multiple
  --                         where mult_code = mult_link_multiple_code
when not matched
then insert
a.MGRP_NUM,
a.MGRP_DESCRIPTION
values
       b.mult_link_multiple_num,
       b.mult_name
end if;
commit;
EXCEPTION
     WHEN OTHERS THEN
        RAISE_APPLICATION_ERROR(-20010,'Error when writing to i-know multiple '||SQLERRM||' '||SQLCODE);
END por_TRG_POP_IKNOW_MULTIPLE2;Thanks
Edited by: user5716448 on 14-May-2013 06:20

Hi,
Get ORA-02064 when try as suggested - distributed transaction not supported.
Thanks
create or replace trigger por_TRG_POP_IKNOW_MULTIPLE
after INSERT OR UPDATE or delete   on por_MULTIPLE
for each row
-- tO ENSURE I-KNOW KEPT UP-TO-DATE WITH HOMIS MULTIPLE
-- delib not delet form i-know as if has been used by customer cannot delete
-- due to referential inetgrity constraints in i-know
-- Note parent_num updated on IKW via support.maintain_latest_dim_version.update_multiple until
-- When IKW becomes master of multiple info, this trigger can be removed
-- and support.maintain_latest_dim_version.update_multiple removed
declare
v_dml_type varchar2(1);
--pragma autonomous_transaction;
begin
   IF INSERTING OR UPDATING
   THEN
MERGE INTO [email protected] a
      USING
       select
       :new.MULT_LINK_MULTIPLE_CODE MULT_LINK_MULTIPLE_num
       from dual
       ) b
    on
       b.mult_link_multiple_NUM = a.mgrp_NUM
--when matched THEN update set
--      a.MGRP_NUM =b.mult_link_multiple_nuM
when not matched
then insert
a.MGRP_NUM
values
       b.mult_link_multiple_num
      MERGE INTO [email protected] a
      USING
       select
       :NEW.MULT_ANMW_MULTIPLE_CODE MULT_ANMW_MULTIPLE_CODE,
       :new.MULT_AUTH_REQUIRED MULT_AUTH_REQUIRED,
       :new.MULT_JMW_MULTIPLE_TYPE_CODE MULT_JMW_MULTIPLE_TYPE_CODE,
       :new.MULT_LINK_MULTIPLE_CODE MULT_LINK_MULTIPLE_num,
       :new.MULT_MULTIPLE_CODE MULT_MULTIPLE_NUM,
       :new.MULT_NAME MULT_NAME,
       :new.MULT_PROM_AUTH_REQUIRED MULT_PROM_AUTH_REQUIRED,
       :new.MULT_SELECTED_MULTIPLE MULT_SELECTED_MULTIPLE,
           'Y' MULT_active_flag,
       nvl(:new.MULT_JMW_MULTIPLE_TYPE_CODE, 0) MULT_CHANNEL_NUM,
       :new.MULT_LINK_MULTIPLE_CODE MULT_PARENT_NUM -- added 14/05/13
       from dual
       ) b
    on
       a.mult_multiple_NUM = b.MULT_MULTIPLE_NUM
when matched THEN update set
       A.MULT_ANMW_MULTIPLE_CODE = B.MULT_ANMW_MULTIPLE_CODE ,
       A.MULT_AUTH_REQUIRED = B.MULT_AUTH_REQUIRED,
       A.MULT_JMW_MULTIPLE_TYPE_CODE = B.MULT_JMW_MULTIPLE_TYPE_CODE ,
       A.MULT_LINK_MULTIPLE_num = B.MULT_LINK_MULTIPLE_num,
       A.MULT_NAME =B.MULT_NAME,
       A.MULT_PROM_AUTH_REQUIRED=B.MULT_PROM_AUTH_REQUIRED,
       A.MULT_SELECTED_MULTIPLe=B.MULT_SELECTED_MULTIPLE,
           A.MULT_ACTIVE_FLAG = B.MULT_ACTIVE_FLAG,
       A.MULT_CHANNEL_NUM= B.MULT_CHANNEL_NUM,
       a.mult_parent_num = B.MULT_LINK_MULTIPLE_num
when not matched
then insert
A.MULT_ANMW_MULTIPLE_CODE,
       A.MULT_AUTH_REQUIRED,
       A.MULT_JMW_MULTIPLE_TYPE_CODE,
       A.MULT_LINK_MULTIPLE_NUM,
       A.MULT_MULTIPLE_NUM,
       A.MULT_NAME,
       a.MULT_PROM_AUTH_REQUIRED,
       a.MULT_SELECTED_MULTIPLE,
       -- NEW FIELDS ON I-KNOW
       a.MULT_ACTIVE_FLAG,
        a.MULT_CHANNEL_NUM,
        a.MULT_PARENT_NUM
values
       b.MULT_ANMW_MULTIPLE_CODE,
       b.MULT_AUTH_REQUIRED,
       b.MULT_JMW_MULTIPLE_TYPE_CODE,
       b.MULT_LINK_MULTIPLE_NUM,
       b.MULT_MULTIPLE_NUM,
       b.MULT_NAME,
       b.MULT_PROM_AUTH_REQUIRED,
       b.MULT_SELECTED_MULTIPLE,
       -- NEW FIELDS ON I-KNOW
       b.MULT_ACTIVE_FLAG,
        b.MULT_CHANNEL_NUM,
        b.MULT_LINK_MULTIPLE_NUM
else
     update [email protected] p
     set  mult_active_flag = 'N'
     where  p.mult_multiple_num = :old.mult_multiple_code;
END IF;
if inserting
then
   v_dml_type := 'I';
else
  if updating
  then  
     v_dml_type := 'U';
  else
     v_dml_type := 'D' ; 
  end if;  
end if;
/*INSERT INTO IKNOW_AUDIT_MULTIPLE_CHANGES
MULT_MULTIPLE_CODE,
MULT_NAME,
MULT_SELECTED_MULTIPLE,
MULT_ANMW_MULTIPLE_CODE,
MULT_LINK_MULTIPLE_CODE,
MULT_JMW_MULTIPLE_TYPE_CODE,
MULT_AUTH_REQUIRED,
MULT_PROM_AUTH_REQUIRED,
dml_type,
DATE_ACTIONED,
MULT_PARENT_NUM
values
       :new.MULT_MULTIPLE_CODE ,
       :new.MULT_NAME,
       :new.MULT_SELECTED_MULTIPLE,
       :NEW.MULT_ANMW_MULTIPLE_CODE,
       :new.MULT_LINK_MULTIPLE_CODE,
       :new.MULT_JMW_MULTIPLE_TYPE_CODE ,
       :new.MULT_AUTH_REQUIRED ,
       :new.MULT_PROM_AUTH_REQUIRED,
       v_dml_type ,
       sysdate,
       :new.MULT_LINK_MULTIPLE_CODE
EXCEPTION
     WHEN OTHERS THEN
        RAISE_APPLICATION_ERROR(-20010,'Error when writing to i-know multiple '||SQLERRM||' '||SQLCODE);
END por_TRG_POP_IKNOW_MULTIPLE;

Similar Messages

  • Error in Forms while creating the trigger- WHEN-CREATE-RECORD

    Hello,
    Right now I am using 11g client side and 10g database.
    I am constantly getting an error while creating triggers in 11g.
    I have created a sequence in SQL developer using the following code:
    create sequence loc_id_sequence
    start with 14;
    After creating the sequence. I am trying to write the PL/SQL code in forms builder for the trigger WHEN-CREATE-RECORD
    declare
    loc_id number;
    begin
    loc_id := loc_id_sequence.nextval;
    end;
    But I have been getting the following error constantly. Can anyone please help me?
    "Error 0 at line 5, column 4
    SQL statement ignored".
    Can anyone please tell me why I am getting that error

    In fact, even I thought there might be some problem with the connectivity with the 10g database and 11g client but the other DB related code works.
    I just have the problem with using sequence for the trigger WHEN-CREATE-RECORD.
    In fact I also tried using WHEN-NEW-RECORD-INSTANCE smart trigger instead of WHEN-CREATE-RECORD for the same sequence. But even that doesn't work.
    Do u have any idea of what that error means?
    "Error 0 at line 5, column 4
    SQL statement ignored"
    Edited by: Pooja 1985 on Feb 26, 2013 5:43 PM
    Edited by: Pooja 1985 on Feb 26, 2013 5:44 PM

  • Having Millions of Records in table how we can reduce the exicution time

    We have developed report it takes time to  running eighteen hours   background job monthly data because having millions of records in tables and used loops also Could you please help me how can read record million wise as parrlel exicution to reduce time

    Moderator message - Welcome to SCN.
    Please search the forums before asking a question.
    Also, Please read Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!! and How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
    Thread locked.
    Rob

  • When-create-record ora-03114

    This error occurs if you open a cursor, or if you use SYSDATE in a trigger when-create-record.
    Can anyone help me?

    Telling us you have forms 11 and database 11 is a very unspecific statement considering there are 2 major versions for each (11gR1 and 11gR2 for both forms and database) with each having several patchsets. So all in all there are a lot of combinations you could have, which probably could be the cause of your problems.
    What I'd do is take a look at the alert.log of the database, and bring both forms and the database to the latest patchlevel of whatever major release you are using.
    cheers

  • What the best way to create User defined table with ADDON purpose

    Hi folks, how are you ?
    I´m beginner in development to business one, and I m studying to develop ISV addons.
    But, during my exercises and analisys, I learned that have two ways to create tables and fields in business one. One way is throght by wizard in business one using Tools Menu > Configuration Tools > User Defined Tables >
    Obs: I ´m using Business One Patch Level 9.
    Other way, is create the tables and fields using DI API
    But, my question is. When I develop one addon, or one UDO form that uses one set of user defined tables or used defined fields that where created by the first way (by wizard in B1), how I deploy this in other business one installation ? The package process will ensure the creation of this tables in another enviroment or I must implement the creation of user defined tables using DI API so that this code is called during the installation?
    If in cases of addon develop I must use DI API to create user defined tables, How can I use my classes with this responsibility in package process ?
    Thanks my friends.

    Hi Renan,
    You just need to put your logic in to the startup of your application, after you've established your connection to the UI API and DI API. All this will be triggered in the constructor of your main class.
    namespace MyNamespace
    public class MyAddon
      bool runAddon = true;
      bool initialised = false;
      const string ADDON_NAME = "My Addon";
      public static void Main()
            MyAddon addOn = new MyAddon();
            if(runAddon)
                  System.Windows.Forms.Application.Run();
            else
             Application.Exit();
      public MyAddon()
            // Connect to SBO session for UI
            if(!SetApplication()) runAddon = false;
      private bool SetApplication()
            // Code goes in here to establish UI API and DI API connections
            // See SDK samples for examples
            // You should also define and filter the UI API events your addon will trap at this stage and create any menus
            // Call your routine to check if the required UDFs/UDTs exist on this company
            initialised = CheckInitialisation();
            if (!initialised)
               //  AddOn not yet intialised on this company so prompt the user to run the intialisation process
              int iResponse = app.MessageBox("The " + ADDON_NAME + " addon will now create all required fields and tables."
                                             + System.Environment.NewLine + System.Environment.NewLine
                                             + "WARNING: It is strongly recommended that all other users are logged out of this company "
                                             + "before running this process. Are you sure you wish to continue?", 2, "Yes", "No", "");
              if (iResponse == 1) initialised = InitialiseAddOn(); // Call your routine to create the objects
            return true;
    Kind Regards,
    Owen

  • Help needed writing trigger for deleting records from multipul tables

    i am trying to write a trigger which would help me delete the record from 3 different tables
    lets say i have table a , b and c
    i an trying to write a trigger which would help me delete the same record from table a and c.
    drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or UPDATE or DELETE ON az_employ
    FOR EACH ROW
    BEGIN
    IF DELETING then
    delete from za_payroll
    delete from az_salary_audit
    end if;
    end;
    while executing this trigger all data of table za_payroll is delete.
    what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_audit

    872959 wrote:
    i am trying to write a trigger which would help me delete the record from 3 different tables
    lets say i have table a , b and c
    i an trying to write a trigger which would help me delete the same record from table a and c.
    drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or UPDATE or DELETE ON az_employ
    FOR EACH ROW
    BEGIN
    IF DELETING then
    delete from za_payroll
    delete from az_salary_audit
    end if;
    end;
    while executing this trigger all data of table za_payroll is delete.
    what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_auditutilize appropriate WHERE clause

  • Creating a Detail Table Based on an Action in Another Table or Matrix to Display in the Same Report (Not a Drill-Through)

    Hello,
    I was wondering if it's possible have a matrix which shows total credits by month and have drill-down groupings to display the invoice numbers for each credit.  Then, once the drill-down is expanded for a particular month, be able to click on the invoice
    number and have another table under the matrix display the details of the invoice. 
    I don't really want a drill-through because that opens a different report in the window, what I want to be able to do is stay on the main report.  I also don't want to drill-into the invoice details from the matrix as that expands the matrix out and
    makes it unruly and ugly.  I've been playing with subreports but not able to get what I want out of it.
    I hope this makes sense - is there a way to do this in SSRS?
    Thanks!!

    Hi AvenueStuart,
    After testing the issue in my environment, we can refer to the steps below to work around the issue:
    Create a new table with the details of the invoice under the matrix.
    Add a parameter named invoice which get available values from the invoice field in the dataset.
    Right-click the [Sum(invoice)] cell to add an action with “Go to report” option, and specify the same report with the parameter below:
    Name: invoice                                                                 
    Value: [invoice]
    Right-click the table to add a filter in the table:
    Expression: [invoice]
    Operator: =
    Value: [@invoice]
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to process each records in the derived table which i created using cte table using sql server

    I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
    how to process each records in the derived table which i created using  cte table using sql server

    Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • HOW TO create a temp table or a record group at run time

    i have a a tabular form and i dont want to allow the user entering duplicate
    records while he is in insert mode and the inserted records are new and not exsisting in the database.
    so i want to know how to create a temp table or a record group at run time to hold the inserted valuse and compare if they are exsiting in previous rows or no.
    please help!

    As was stated above, there are better ways to do it. But if you still wish to create a temporary block to hold the inserted records, then you can do this:
    Create a non-database block with items that have the same data types as the database table. When the user creates a new record, insert the record in the non-database block. Then, before the commit, compare the records in the non-database block with those in the database block, one at a time, item by item. If the record is not a duplicate, copy the record to the database block. Commit the records, and delete the records in the non-database block.

  • Problems in creating records in z table

    Dear All
    I have created a z table, initially i created some records in it, using SM30. But now i am not able to create any record. Kindly help me in this.
    Regards
    Deepti

    what message your getting....
    Please let me know . so that can suggest you the right appraoch..
    one reason might be you have done the changes for the table...
    so check the table is active in dictionory or not... if active
    goto utilities -- > databaslity and activate and adjust database.
    also regenerate the table maintaince generator...
    Please let me know if you need further information
    Regards
    Satish Boguda

  • How to create a record for table PLAF with order type 'NB'.

    How to create a record for table PLAF with order type 'NB'(standard purchase order).
    who can tell me the T-code or some usefull information?
    Thanks.

    Hi
    This will be updated automatically when generate planned orders thru MRP. (MD02)
    regards
    Srinivas

  • Creating LOV  in Table Action.

    Hi,
    Can we create a LOV in table action ,if yes then is LOV Action button is the only way of achieving that.As lot of issue are there if i use LOV action instead of LOV as no criteria item is present in LOV action button.
    Thanks

    HI,
    What i was trying to ask is ,am trying to create a LOV in table's table action section.Its working fine till am trying to search any thing in the LOV,Now when i select a item the I.E page show a error logo below and the control doesn't come's back to the main page.
    So i want to know wheather creating LOV in table action section is feasible or not as in devloper guide things are mentioned on creating message components and message choice in table action.
    Thanks

  • FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-06502.

    Hi Guys,
    I am a beginner in Oracle apps and have been trying to setup receivables module. I have completed all necessary setups such as system options, transaction types, transaction sources, Auto accounting etc.
    Now, when I try to open transaction window, I am getting the following error
    FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-06502
    RDBMS : 11.2.0.2.0
    Oracle Applications : 12.1.3
    Thanks in advance.. :-)

    Please see these docs.
    Repair Orders Form Error: 'FRM-40735: When-Create-Record Trigger raised unhandled exception ORA-06502' For Instances With Alphanumeric Instance Numbers [ID 580147.1]
    FRM-40735:WHEN-CREATE-RECORD Trigger Raised Unhandled Exception ORA-06502 [ID 125204.1]
    Attempt To Open IGIPAPPF Approval Profile Form Fails With Error: FRM-40735 WHEN-CREATE-RECORD Trigger raised unhandled exception ORA-06502 [ID 418546.1]
    Transactions Workbench Error: ORA-06502 [ID 1295626.1]
    Transactions Workbench Error: Listing of FRM Errors [ID 1321612.1]
    Forms Error: FRM-40735 [ID 1295620.1
    Credit Transactions Form Errors Out With FRM-40735 [ID 1079945.1]
    Thanks,
    Hussein

  • FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-01403

    hi
    when i am searching AP module and
    Payables Manager - > Oracle Payable - > Setup -> Invoice-> Distribution Set
    i am getting this FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-01403.
    what to do?
    RHEL 5.3
    EBS 12.0.0 RUP 6
    1)I have tried adadmin compling forms
    2)generating trace and tkprof but still found none.
    what to do?
    Regards
    Edited by: new2appsdba on Jul 16, 2010 1:33 AM
    Edited by: new2appsdba on Jul 16, 2010 1:37 AM

    hsawwan wrote:
    Hi,
    Please see if (Note: 1074119.1 - R12. APXINWKB: When Trying To Change Invoice Distribution Line Type Get Error: FRM-40735:PRE-RECORD Trigger Raised Unhandled Exception.ORA-01403) is applicable.9747677:R12.AP.B patch which is for 12.1 and made the SR.
    >
    If this does not help, obtain the FRD file and see if more details are collected in the logs.
    Note: 445166.1 - How to create a FRD (Forms Runtime Diagnostic) Log in EBusiness Suite R12 using Forms 10gwatching
    Note: 438652.1 - R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle Applications
    Note: 867943.1 - Steps To Take FRD Trace in 11.5.10 & R12
    Thanks,
    Hussein

  • FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-01422

    when i am searching AR module and
    Receivables - > Transactions - > Transactions
    i am getting this FRM-40735: WHEN-CREATE-RECORD trigger raised unhandled exception ORA-01422.
    what to do?

    user9095240 wrote:
    Hi,
    1. This form was working fine until patch 8407693 has been applied.
    2. Yes, I'm getting this error in every responsibility or user
    3. No, no personalizations
    I've read another time docs Hussein linked and as in "Troubleshooting Transaction Types In Oracle Receivables (Doc ID 1090878.1)" Patch Related paragraph, seems like I need  Patch 8302210:R12.AD.B cause my admorgb.pls  version is 120.21.12010000.2 instead of 120.21.12010000.3. I think replicate seed data program duplicated something in db. Is it possible?
    Regards
    With the information you have provided so far, it's hard to say that the cause of the issue is because of this file (version). However, if this is a test instance you may proceed and apply the patch and see if it helps.
    Thanks,
    Hussein

Maybe you are looking for

  • Thunderbolt + DVI chained monitors on Macbook Pro

    Hi All,   I'm a software engineer, and I work on building distributed systems.  I usually have my IDE window open on my Thunderbolt display and several terminal/ssh windows open on my MBP's display.  I'm getting to the point where I'm connecting to t

  • Cannot connect to JDBC data source

    We are trying to configure Visual Composer to connect to the backend BI-ABAP BI database which is DB2, from the Visual Admin on the windows box. Downloaded the driver for DB2 JDBC from IBM website (ibm_data_server_driver_package_win64_ALL_LANG_v97.ex

  • Tap Tap Revenge on iPod Touch/iPhone

    Anyone downloaded a game application called Tap Tap Revenge? It's for iPod Touch/iPhone with the 2.0 software upgrade. I browsed through the iTune's Application Store today and found this game. It looks awesome, but when I tried to purchase it for fr

  • Error occures when i try to download song on ipod

    every time i try downloading a song i get an error and it wont dl to my ipod so i can listen to it

  • Photoshop Elements 9 only opens to the Welcome screen.

    Elements 9 only opens to the Welcome screen. Organiser and Edit will not open. I cannot deactivate the programe so I can re-install. I have tried pressing Ctrl+Alt+Shift but nothing happens.