Insert in Multiple Tables ReceiverJDBC in sequence

Hello Experts,
I have an interface in which i need to insert into 4 tables, i know that is possible using receiver JDBC with multiple statement but My requirement is that data should be inserted in sequence.
Table1 then table2 then tab3 and tab4 as they have constraints.
I know that it can be achieved by using Stored Procedure, or having a staging table and then some other SP inserting data in sequence after reading staging table.
Is there any other way to achieve it ? (NO BPM). Any new functionality to achieve that in PI 7.11 ?
Regards
Inder

Since you are going to insert data into 4 tables in a sequence one after another , I see three options.
You already mentioned  2 options  1) Stored procedure and 2) creating 4 statement data structure (one for each table)
The third option is writing a SQL with join for the 4 tables and use action command = SQL_DML.   Example as follows....
Write SQL code and place it in access tag.  Pass values for the columns using key tag...
<stmt>
    <Customers action="SQL_DML">
      <access> UPDATE Customers SET CompanyName=u2019$NAME$u2019, Address=u2019$ADDRESS$' WHERE CustomerID='$KEYFIELD$u2019
      </access>
      <key>
        <NAME>name</NAME>
        <ADDRESS>address </ADDRESS>
        <KEYFIELD>100</KEYFIELD>
      </key>
    </Customers>
  </stmt>
Refer this [link|http://help.sap.com/saphelp_nwpi71/helpdata/en/44/7b7855fde93673e10000000a114a6b/content.htm]...
Hope this helps ....

Similar Messages

  • Insert to multiple tables while keeping the referential integrity

    I would like to confirm whether we can have both updatable and reference for secondary entity. It seems to me that even though both updatable and reference can be checked for secondary entity, the secondary entity is not updatable.
    There are some scenarios that I hope to create the "parent" and "child" at the same time in the UI. For example, Employee and ProductExpertise which is in m:m relationship. We have three tables: Employee, EmployeeProduct, and Product. We have two view object, EmployeeVO which contains EmployeeEO, EmployeeProductVO which contains EmployeeProductEO and ProductEO. This can display EmployeeVO as master, and EmployeeProductVO as detail. However when we add a new product for the employee, we can only associate an existing product. We would like to create a new product and associate the product with employee. This cannot be achieved by the current EmployeeProductVO.
    I wonder if ADF supports inserting to multiple tables while keeping the foreign key reference integrity? In other words, in a 1:1..* (1 to 1 or 1 to many) relationship, must we have a master-detail view where we add parent first, then add child? Does ADF support adding both parent and child together with the correct foreign key assigned automatically for the child? Do we need to write code to do it?
    Any insight is appreciated.

    Hi,
    Assuming you are talking about ADF Business Components, yes, the framework can handle a batch insert that inserts both parent and child records in the same transaction. A few things that you may want to review:
    1). If you are using a database sequence for your primary keys (your question "Does ADF support adding both parent and child together with the correct foreign key assigned automatically for the child" made me think perhaps you were), have a read of the Fusion Developer's guide about the DBSequence type.
    2). In the same guide, have a read of section 38.8 - it talks about the small bit of code you may need to write to ensure the parent record is posted before the children, and also discusses about associations that are based on DB Sequences.
    Best,
    John

  • Insert into multiple table view

    I have a view with multiple table query and and INSTEAD OF trigger on the view that inserts into multiple tables. When I attempt to do a commit out of a ADF Creation Form, I get the following error: ORA-01779: cannot modify a column which maps to a non key-preserved table ORA-06512: at line 1.
    Has anyone had success inserting into multiple tables via a view that has more than one table?
    Thanks,
    Lisa

    Lisa,
    Sounds like your instead-of trigger may not be being called and you are trying to insert directly into the view.
    I did write a [url http://stegemanoracle.wordpress.com/2006/03/15/using-updatable-views-with-adf/]blog entry about using a view with instead-of triggers last year.
    John

  • BizTalk 2013 R2 - Oracle client (Insert into Multiple tables) CompositE Transaction

    I know there is Composite Transaction of  inserting into multiple tables in SQL.
    Is there a way where we can have inserts into multiple table at once ? If yes, can anyone please provide step by step procedure to achieve this  
    MBH

    Here is a link on using Oracle DB w/ composite operations: 
    Performing Composite Operations on Oracle Database by Using BizTalk Server
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Insert/update multiple tables from one form.

    I'm working on an app. that requires the user to fill out a form. The contents from the form is then used to either insert new records or update existing records in multiple tables. Is that possible? Can someone give a details example?

    You should create a form like you would create it having one table. Use row_id as primary key. The rest of the process are done by the triggers - those will take care of updating the right table depending which column was hit.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Inserting into multiple tables on one form using UIX

    We are developing an application using struts and UIX. We would like to be able to insert into three tables on one form(view). How can we accomplish this?

    This is more of an ADF question, you'll need to set up view object, than just drag it from the data control palette like normal.
    If it's not already set up as a view in the db (split into multiple tables), you'll need to create a view object that includes all the fields you want, based on multiple entity objects.

  • Insert to Multiple Tables

    Hi,
    I am inserting to Table 1 (which sets the primary key - generated by a sequence) and also to Table 2 which references the primary key in Table 1 as a foreign key.
    Is there a way to reference the Table 1 primary key as a foreign key in the Table 2 insertion? Thanks.

    Are you using sequence directly in your insert statement. If so, you can user CURRVAL:
    INSERT INTO T1 VLAUES(...seq.nextval...);
    INSERT INTO T2 VALUES(...seq.currval...);Or you can use RETURNING INTO if, for example, PK value is generated in a trigger.
    SY.

  • Insert to multiple table using single DB Adapter

    Hi,
    I m using Jdev 11g Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    Can anyone tell me how can we do insert and update operations to mutliple tables using single DB adapter.
    I want to do insert in 2 tables and update the third using same DB apater. Is it possible?If yes, how?

    Hi,
    You can write a PL\SQL (Stored Procedure) to do your operations and call the PL\SQL code from DB Adapter.
    -Senaka

  • Insert into multiple tables using a page variable

    Hi Guys,
    I was going to trawl the PL/SQL forum for this but as I need to use a page variable I thought I would try here first.
    I have 4 tables 2 live and 2 archive, company_table, company_table_arch, product, product_arch the tables are set up with a company Id as the join.
    you can have multiple products to a company.
    what I want to do is have an archive button on a form that will select the current record on the company table, and insert it into archive then select all records with that id in the product table and insert them into the product_arch table.
    I was thinking about doing this as a couple of page proccess, sound about right?
    the other option was using a package,
    is it possible to use page variables in a package? If so what is the sintax
    cheers
    Bjorn

    OK, I have got the basis of this working I press the archive button and the records update as per the code.
    I have one problem however.
    The button is on a form. and if the user updates the form then presses the archive button it copies the data before the table is updated (the table is updated using a save button).
    One way round this would be to jump to an "are you sure?" page
    Does anyone know a better way of doing this?
    cheers
    Bjorn

  • INSERT ALL - Multiple table insert issue

    There are three tables A, B, C. A has three rows. It has record of table B + 1 row. B has two rows, has record of table C + 1 row. C has one row.
    SQL> SELECT * FROM A;
            C1         C2                                                          
             1          1                                                          
             2          2                                                          
             3          3                                                          
    SQL> SELECT * FROM B;
            C1         C2                                                          
             1          1                                                          
             2          2                                                          
    SQL> SELECT * FROM C;
            C1         C2                                                          
             1          1                                                          
    I need to write a single query which make rows equal in all tables. I use INSERT ALL WHEN INTO method but get following errors:
    SQL> INSERT ALL
      2  WHEN A.c1 NOT IN ( SELECT c1 FROM B) THEN
      3  INTO B VALUES(A.c1, A.c2)
      4  WHEN A.c1 NOT IN (SELECT c1 FROM C)  THEN
      5  INTO C VALUES(A.c1, A.c2)
      6  SELECT c1, c2 FROM A;
    INTO C VALUES(A.c1, A.c2)
    ERROR at line 5:
    ORA-00904: "A"."C2": invalid identifier
    However when I change columns names of all table and change INSERT ALL clause. I was able to execute it:
    SQL> select * from a;
            A1         A2                                                          
             1          1                                                          
             2          2                                                          
             3          3                                                          
    SQL> select * from b;
            B1         B2                                                          
             1          1                                                          
             2          2                                                          
    SQL> select * from c;
            C1         C2                                                          
             1          1                                                          
    SQL> INSERT ALL
      2  WHEN A1 NOT IN ( SELECT B1 FROM B) THEN
      3  INTO B VALUES(A1, A2)
      4  WHEN A1 NOT IN (SELECT C1 FROM C)  THEN
      5  INTO C VALUES(A1, A2)
      6  SELECT A1, A2 FROM A;
    3 rows created.
    My question is: What is the error with previous syntax? Is there any limitation of INSERT ALL statement.

    Thanks guys  for prompt response.
    I remove tablename aliase and it worked.
    SQL>  INSERT ALL
      2    WHEN c1 NOT IN ( SELECT c1 FROM B) THEN
      3    INTO B VALUES(c1, c2)
      4    WHEN c1 NOT IN (SELECT c1 FROM C)  THEN
      5    INTO C VALUES(c1, c2)
      6    SELECT c1, c2 FROM A;
    3 rows created.
    SQL> select * from c;
            C1         C2
             1          1
             2          2
             3          3
    SQL> select * from b;
            C1         C2
             1          1
             2          2
             3          3
    SQL> select * from a;
            C1         C2
             1          1
             2          2
             3          3
    SQL>
    I really thought it will give me ambiguity error in insert, as column names are same in other table. Generally it gives.
    Nice to know this thing of Multiple Insert

  • Anyone know how to insert to multiple tables on Dreamweaver?

    Hey everyone,
    I'm a bit of a newbie at PHP and am trying to create my first "dynamic" site.  I have a registration table with fields idNo (primary key & auto-increment), username, password, email.  I also have another table called profile with fields idNo, location, musicalInfluences, aboutMe etc.  All of these fields except idNo have the default value of "update."  What I want to be able to do is add a second insert statement to the user registration behaviour so that I can have the idNo number added to the profile tables as well as the registration table.  That way the registration and profile are linked by idNo and I can create a record-set do automatically populate the profile table on my profile page when the user logs in.  All of the different profile traits would say "update" and I can then use an update server behaviour for the user to update there profile.
    I might be approaching this the wrong way so I'm open to suggestions on how to create a user login and linked profile page.  One thing I could not work out was how, when the user clicks login with the correct credentials,  I was supposed to separate a first time user, directed to the create profile page, from a user who has already created a profile page and just wants to see it.  The only way I could think of was by using the default method explained before and then having an update page.  Sorry if that was a bit of a waffle.  Here is my code.  Any help would be much appreciated!!
    This is the script that I have included on my registration page.  I just extracted the php and used an include to keep the html page tidy.
    <?php require_once('Connections/soundstorm.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    // *** Redirect if username exists
    $MM_flag="MM_insert";
    if (isset($_POST[$MM_flag])) {
      $MM_dupKeyRedirect="usernameExists.php";
      $loginUsername = $_POST['username'];
      $LoginRS__query = sprintf("SELECT username FROM registration WHERE username=%s", GetSQLValueString($loginUsername, "text"));
      mysql_select_db($database_soundstorm, $soundstorm);
      $LoginRS=mysql_query($LoginRS__query, $soundstorm) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      //if there is a row in the database, the username was found - can not add the requested username
      if($loginFoundUser){
        $MM_qsChar = "?";
        //append the username to the redirect page
        if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
        $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
        header ("Location: $MM_dupKeyRedirect");
        exit;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "registerForm")) {
      $insertSQL = sprintf("INSERT INTO registration (username, password, email) VALUES (%s, %s, %s)",
                           GetSQLValueString($_POST['username'], "text"),
                           GetSQLValueString($_POST['password'], "text"),
                           GetSQLValueString($_POST['email'], "text"));
      mysql_select_db($database_soundstorm, $soundstorm);
      $Result1 = mysql_query($insertSQL, $soundstorm) or die(mysql_error());
      $insertGoTo = "registerSuccess.html";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    ?>

    you can use a trigger in mysql. this trigger is for new records in your registration table. you can use mysql's last_insert_id() to get the last record inserted. just search for mysql triggers to get more info. note that this is not php code, it is mysql.

  • Stored procedure to insert into multiple tables in sql server 2012, using id col from one table to insert into the other 2

    Hi all,
    Apologies if any of the following sounds at all silly but I am fairly new to this so here goes...
    I have 3 tables that require data insertion at the same time. The first table is the customers table, I then want to take the automatically generated custid from that table and inser it into 2 other tables along with some other data
    Here's what I have so far which does not work:
    CREATE PROCEDURE CustomerDetails.bnc_insNewRegistration @CustId int,
    @CompanyName varchar(100),
    @FirstName varchar(50),
    @LastName varchar(50),
    @Email nvarchar(254),
    @HouseStreet varchar(100),
    @Town smallint,
    @County tinyint,
    @Postcode char(8),
    @Password nvarchar(20)
    AS
    BEGIN
    begin tran
    insert into CustomerDetails.Customers
    (CompanyName, FirstName, LastName, EmailAddress)
    Values (@CompanyName, @FirstName, @LastName, @Email)
    set @CustId = (select CustId from inserted)
    insert into CustomerDetails.Address
    (CustomerId, HouseNoAndStreet, Town, County, PostCode)
    values (@CustId, @HouseStreet, @Town, @County, @Postcode)
    insert into CustomerDetails.MembershipDetails
    (CustomerId, UserName, Password)
    values (@CustId, @Email, @Password)
    commit tran
    END
    GO
    If anyone could help with this I would very much appreciate it as I am currently building an online store, if there's no registration there's no customers.
    So to whom ever is able to help, I thank you whole heartedly :)

    I hope by now it is apparent that statements like "doesn't work" are not particularly helpful. The prior posts have already identified your first problem.  But there are others.  First, you have declared @CustID as an argument for your
    procedure - but it is obvious that you do not expect a useful value to be supplied when the procedure is executed.  Perhaps it should be declared as an output argument so that the caller of the procedure can know the PK value of the newly inserted customer
    - otherwise, replace it with a local variable since it serves no purpose as an input argument.
    Next, you are storing email twice.  Duplication of data contradicts relational theory and will only cause future problems. 
    Next, I get the sense that your "customer" can be a person or a company.  You may find that using the same table for both is not the best approach.  I hope you have constraints to prevent a company from having a first and last name (and
    vice versa).
    Next, your error checking is inadequate.  We can only hope that you have the appropriate constraints to prevent duplicates.  You should expect failures to occur, from basic data errors (duplicates, null values, inconsistent values) to system issues
    (out of space).  I'll leave you with Erland's discussion for more detail:
    erland - error handling.
    Lastly, you should reconsider the datatypes you are using for the various bits of information.  Presumably town and county are foreign keys to related tables, which is why they are numeric.  Be careful you don't paint yourself into a corner with
    such small datatypes.  One can also debate the wisdom of using a separate tables for Town and County (and perhaps the decision to limit yourself to a particular geographic area with a particular civic hierarchy). Password seems a little short to me. 
    And if you are going to use nvarchar for some strings, you might as well use it for everything - especially names.  Also, everyone should be security conscious by now - passwords should be encrypted at the very least.
    And one last comment - you really should allow 2 address lines. Yes, two separate ones and not just one much larger one.

  • Inserting in multiple tables and joining data

    I am using DW8, PHP and MySQL.
    I've created a database for software inventory. One table is
    a list of software products and the other is the licensing
    information. I set it up this way because we have a product such as
    Windows XP that will have different licenses. But the end result
    will be someone clicking on Windows XP and seeing all licenses for
    that product.
    I've created a page to insert into the software table and one
    for the licensing information. Now I need to make a third page so
    that the user can select the product from a dropdown menu and then
    enter the licensing information. I have join setup between the
    tables in the MySQL backend. How do I tell Dreamweaver that the
    license being entered is related to the correct product?
    Thanks!

    Nevermind, I figured out how to do this.

  • Insert into multiple tables; grab id from first

    I apologize if this has been answered elsewhere, but I tried
    searching and got no results.
    I'm trying to insert the contents of one form into two
    tables. After inserting some fields into one table, I want to grab
    the key/id from the first table into the second table with the
    other fields.
    I've tried a few different things, including trying to use
    SCOPE_IDENTITY(), but just kept getting lots of errors.
    The current version of my code works perfectly, *except for
    the fact that it doesn't insert the ID*!
    Can anyone tell me what I'm doing wrong? or offer another way
    of doing this?
    Thanks for your help, as usual.

    MarianneStone wrote:
    > The current version of my code works perfectly, *except
    for the fact that it doesn't insert > the ID*!
    > Can anyone tell me what I'm doing wrong?
    The EmployeeID is not inserted because the getMyID query
    cannot find the newly inserted record. When using a UUID to
    identify the new records ..
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="result">
    INSERT INTO Employee(... , EmpUUID)
    VALUES ( ... , '#CreateUUID()#')
    </cfquery>
    You have to use that _same_ UUID to find the record, _not_
    create a new one.
    <cfquery name="getMyID" datasource="#db#">
    SELECT EmployeeID, EmpUUID
    FROM Employee
    WHERE Employee.EmpUUID='#UseTheSameUUIDFromTheFirstQuery#'
    </cfquery>
    As an aside, you could probably do this in two queries not
    three. Just drop the second SELECT query and use an INSERT
    INTO/SELECT .. FROM Table statement instead. Plus you should also
    consider using cfqueryparam for your query parameters. It has many
    benefits.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_18.html#1102474
    > Can anyone ... offer another way of doing this?
    There are a few options. For ColdFusion 8, you could use the
    result attribute. After running the INSERT you can grab the new
    EmployeeID by using #yourResult.IDENTITYCOL#
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="yourResult">
    INSERT INTO Employee ( Columns here )
    VALUES (... values here ...)
    </cfquery>
    For earlier versions, you can either use SCOPE_IDENTITY() or
    a UUID value - as you are currently doing now.
    > I've tried a few different things, including trying to
    use SCOPE_IDENTITY(),
    > but just kept getting lots of errors.
    If you use SCOPE_IDENTITY() turn off the rowcount, or the
    query variable "qAddDeptHead" may be undefined when you try and use
    it.
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="yourResult">
    SET NOCOUNT ON;
    INSERT INTO Employee ( Columns here )
    VALUES (... values here ...)
    SELECT EmployeeID AS NewEmployeeID
    SET NOCOUNT OFF;
    </cfquery>
    <cfquery name="qNewEmpPosition" datasource="#db#">
    INSERT INTO EmployeePositions(EmployeeID, .... )
    VALUES ( #qAddDeptHead.NewEmployeeID#, ....)
    </cfquery>

  • How to achieve atomic insertion in multiple tables in ADF ?

    I am trying to implement a situation where:-
    There is a screen which allows the user to enter information regarding "Orders" and "OrderLines". The information related to the orders is stored in the "Orders" table & information related to order lines in the "OrderLines" table.
    Say for a particular order, there are 4 order lines, then one record should get inserted into the "Orders" table and 4 in the "OrderLines" table. Each record in the "OrderLines" table will have a foreign key reference to the record for the new order.
    So the point is that I want both these operations-insertion into the "Orders" table and insertion in the "OrderLines" table to be atomic i.e. either both operation succeed or both operation fail.
    How to do this in ADF ?
    Any Help.

    Thanks for the Reply,
    But I want both these operations-insertion into the "Orders" table and insertion in the "OrderLines" table to be atomic i.e. either both operation succeed or both operation fail.
    If there was an insert action on first table and 2nd one fails then i want to rollback the changes in first table as well.
    Is this default?

Maybe you are looking for