Xsql multiple table insert

I'm having trouble getting my xml document inserted into multiple tables. My xml has a parent child relationship. The main node is the parent I'll call <CAKE> then later on in the xml doc it has a node called <INGREDIENTS> which is a repeating element (more than 1). I need to insert information from the root node, <CAKE> into 1 table and all the info from <INGREDIENTS> node into another table.
I've tried to get Steve Muench's book a try (chapter 14) but when I try to run the examples from the book (XMLLoader) i get the following error.
C:\jdev9i\jdk1.3\bin\javaw.exe -ojvm -classpath C:\jdev9i\jdev\mywork\orxmlapp\Examples\ch14\classes;C:\oracle\ora81\RDBMS\jlib\xsu12.jar;C:\jdev9i\lib\xmlparserv2.jar;C:\jdev9i\jdev\lib\jdev-rt.jar;C:\jdev9i\jdbc\lib\classes12.jar;C:\jdev9i\jdbc\lib\nls_charset12.jar;C:\jdev9i\jlib\jdev-cm.jar;C:\jdev9i\rdbms\jlib\xsu12.jar;C:\jdev9i\lib\xmlparserv2.jar;C:\jdev9i\lib\xmlcomp.jar;C:\jdev9i\lib\oraclexsql.jar;C:\jdev9i\rdbms\jlib\xsu12.jar;C:\jdev9i\lib\xsqlserializers.jar;C:\jdev9i\lib\xmlparserv2.jar;C:\jdev9i\jdev\mywork\orxmlapp\Examples\ch14\classes;C:\jdev9i\jdev\mywork\orxmlapp\Examples\ch14\classes;C:\jdev9i\jdev\mywork\orxmlapp\Examples\ch14\classes -
mx50m
XMLLoader -file deptempdepend.xml -transform deptempdepend.xsl
Processed 1 Documents
Node doesn't belong to the current document.
Error: java.lang.NullPointerException
Process exited with exit code 0.

I made the changes in the java files as per the previous
reference, but I'm still getting an error. Seeing that I'm not
much of a Java guy yet, I'm not sure where to debug the error.
So here it is:
XMLLoader -file deptempdepend.xml -transform deptempdepend.xsl
Processed 1 Documents
null
Error: java.lang.NullPointerException
Process exited with exit code 0.
I tried to debug it and came to the conclusion that it is
failing at line 22 of ConnectionFactory
The value connNode is returend as null.
I don't understand why:
I ran testxpath.exe for the connections file.
C:\jdev9i\jdev\mywork\orxmlapp\Examples\ch14>testxpath connections.xml
Type an XPath expression to test and press [Enter]
To quit, press [Enter] without entering a path.
connections.xml> /connections/connection[@name='doug']
<connection name="doug">
<username>user</username>
<password>password</password>
<dburl>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=dtxml.hmms)))</dburl>
<driver>oracle.jdbc.driver.OracleDriver</driver>
</connection>
connections.xml>
and it returned what i thought would be the correct nodes.
Any help would be appreciated
Doug

Similar Messages

  • Multiple-table inserts

    Hi,
    As part of a project I am working on I need to insert records into 3 tables and have to write a stored procedure for that. An e.g to that affect is as follows:
    Say I have 3 tables NAMES (lname,fname), ADDRESS(addr1,addr2), PHONE(hphone). How do I write a single stored proedure that takes five arguments (lname,fname,addr1,addr2,hphone) and insert these into each of the tables mentioned above. I want to do these in the context of one transaction. I.e. if in the worse case scenario I loose connection to the database after inserting into NAMES, ADDRESS tables, I should rollback the transaction because as the hphone has not been inserted into the PHONE table.
    I would greatly appreciate any input on this issue.
    Thanks.

    Just a quick example :
    SQL> insert into mytable1 select * from all_objects where rownum<=10;
    10 rows created.
    SQL> insert into mytable2 select * from all_objects where rownum<=10;
    10 rows created.
    SQL> <--------------- here, from an other session, I kill the current one
    SQL> select count(*) from mytable1 ;
    select count(*) from mytable1
    ERROR at line 1:
    ORA-00028: your session has been killed
    SQL> conn sysadm/****@mydb
    Connected.
    SQL> select count(*) from mytable1 ;
      COUNT(*)
             0
    SQL> select count(*) from mytable2;
      COUNT(*)
             0
    SQL> As expected, no rows in neither of the tables, insert statement haven't been committed.
    Of course, you shouldn't explicitly commit yourself between the insert statement to keep the data consistency. That's say, I wouldn't understand why search insert in one time into three tables with different structure.
    There is solution to insert into multitable in one time, but not to avoid what you think, see exemple here.
    Nicolas.

  • Multiple table insert xml to mssql

    Hello experts,
    I am trying to insert the data of an xml file into 3 target tables (mssql).
    The dependencies are the following:
    tables: --- timesheetcode -- assignment -- workhours
    attribute: --- tsCodeId - - - - - - tsCodeId - - - - - - assignmentId
    So there is a parent-child relationship between the tables. The tsCodeId and the AssignmentId are being created as an 16 byte uniqueIdentifier. So when creating multiple interface to do these inserts how do I get the generated Id's that I need for the childs? I found the following topic but it is oracle based and I don't think this fully solves my problem:
    How to load multiple target tables simultaneously in single interface?
    thanks a lot for your suggestions
    Edited by: iadgroe on Apr 30, 2012 12:42 AM

    If your XML file contains these relationships in form of nested tags, then you dont have to worry.
    ODI reverse engineering will create an XML data model that will maintain the relationship of data with ODI generated surrogate keys.
    Then you can load your data one by one in to timesheetcode, assignment and workhours using the corresponding interfaces from XML datastores.

  • 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

  • Multiple table insert using receiver jdbc adapter

    Hi,
    I am trying to insert data in to two tables in a single structure using receiver jdbc adapter. I am not using any stored procedure to insert data instead directly inserting the data using PI. Please see the structure I am using.
    SOURCE side:
    DT_ABC_SENDER
    --IT_HEADER_TEXT
      -- EBELN
      -- LINENO
      --TDTEXT
    --IT_ITEM_TEXT
      -- EBELN
      -- LINENO
      --TDLINE
    TARGET side:
    DT_ABC_RECEIVER
    --InsertStatement
         --HEADER_TEXT
                -- action                         (insert)
                -- Table                          (Table 1)
                --access
                     -- IDS_ENQ_NO
                     -- IDS_DESC
                     -- IDS_TEXT
       --ITEM_TEXT
                -- action                         (insert)
                -- Table                          (Table 2)
                --access
                     -- IIS_ENQ_NO
                     -- IIS_DESC
                     -- IIS_TEXT
    Using the above structure I am able to successfully insert the data in Table 1 but data is not getting inserted in Table 2.
    In sxmb_moni it is saying message successfully delivered but I but there is data insertion took place in Table 2.
    Please help me urgently.
    Thanks in advance.
    Neeeraj

    Hi Neeraj,
    Add --InsertStatement statement for the second table structure in the same level of first InsertStatement.
    Target structure like this:
    DT_ABC_RECEIVER
    --InsertStatement
         --HEADER_TEXT
                -- action                         (insert)
                -- Table                          (Table 1)
                --access
                     -- IDS_ENQ_NO
                     -- IDS_DESC
                     -- IDS_TEXT
    --InsertStatement
       --ITEM_TEXT
                -- action                         (insert)
                -- Table                          (Table 2)
                --access
                     -- IIS_ENQ_NO
                     -- IIS_DESC
                     -- IIS_TEXT

  • Multiple table insert via dblink

    Hi,
    We have an oracle database which contains a number of tables.
    From these tables I need to be able to populate a number of holding tables in a MSSQL database via a nightly scheduled job.
    Therefore I will insert into these tables via a procedure from my oracle tables.
    I need to ensure that if any of the inserts fail for a particular record I am uploading out of the five insert statements then the whole process is rolled back.
    I therefore having something like the following
    FOR cursor1_rec IN cursor1_cur LOOP -- This gives me the records I need to insert into the holding table for
    BEGIN
    INSERT into ms_holding_table_1
    (field1, field2)
    select 1,2 from oracle_table_1
    where id = cursor1_rec.id;
    INSERT into ms_holding_table_2
    (field1, field2, field3, field4)
    select 1,2,3,4 from oracle_table_2
    where id = cursor1_rec.id;
    INSERT into ms_holding_table_3
    (field1)
    select 1 from oracle_table_3
    where id = cursor1_rec.id;
    INSERT into ms_holding_table_4
    (field1, field2)
    select 1,2 from oracle_table_4
    where id = cursor1_rec.id;
    END;
    END LOOP;
    I need to ensure that if the insert for that particular cursor record fails on the 2nd insert statement, the first insert also rollbacks. Likewise if it fails on the 4th insert, I need to ensure that all 4 inserts are rolled back.
    If you could provide me with any information as to how to achieve this.
    Would issuing a savepoint before the first insert statement and then in my exceptions rolling back to the savepoint before the end of the loop suffice?
    Thanks in advance,
    ca84

    This is anonymous block but you can extend it add more defensive mechanism and def you can make it small procedure or part of some package. Hope this helps
    DECLARE
    CURSOR cur
    IS
    SELECT statement
    FROM table_name;
    BEGIN
    INSERT INTO ms_holding_table_1
    field1, field2
    SELECT 1, 2
    FROM oracle_table_1
    WHERE id = cursor1_rec.id;
    INSERT INTO ms_holding_table_2
    field1, field2, field3, field4
    SELECT 1, 2, 3, 4
    FROM oracle_table_2
    WHERE id = cursor1_rec.id;
    INSERT INTO ms_holding_table_3 (field1)
    SELECT 1
    FROM oracle_table_3
    WHERE id = cursor1_rec.id;
    INSERT INTO ms_holding_table_4
    field1, field2
    SELECT 1, 2
    FROM oracle_table_4
    WHERE id = cursor1_rec.id;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.put_line (SUBSTR (SQLERRM, 1, 200));
    RAISE;
    END;

  • In ADF how can i insert data in multiple table if they have foreign key

    I have started working on ADF and can anybody inform me in ADF how can i insert data in multiple table if they have foreign key,please?
    Thnak you very much.

    Hello,
    Still no luck.I am surely doing silly mistakes.Anyway,Here are my workings-
    1> student_mst (id(pk),studentname) and student_guard_mst(id(fk),guardianname)
    2> created EO from both of the tables,made id in both EO as DBSequence and an association was also generated.
    3> i made that association composite by clicking the checkbox
    4> i created 2 VO from 2 EO.
    5> put those VO in Application Module.
    6> dragged and dropped 2 VO on my jspx page and dropped them as ADF Form.
    Now what to do please?

  • What's the best way to insert/update thousands records in multiple tables

    Can anyone give an example of how to insert/update thousands records in multiple tables on performance wise? or what should I do to improve the performance?
    Thanks
    jim

    You can see a set of sample applications in various scenarious available at
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html

  • Efficient Way of Inserting records into multiple tables

    Hello everyone,
    Im creating an employee application using struts framework. One of the functions of the application is to create new employees. This will involve using one web form. Upon submitting this form, a record will be inserted into two separate tables. Im using a JavaBean (Not given here) between the JSP page and the Java file (Which is partly given below). Now this Java file does work (i.e. it does insert a record into two seperate tables).
    My question is, is there a more efficient way of doing the insert into multiple tables (in terms of performance) rather than the way I've done it as shown below? Please note, I am using database pooling and MySQL db. I thought about Batch processing but was having problems writing the code for it below.
    Any help would be appreciated.
    Assad
    package com.erp.ems.db;
    import com.erp.ems.entity.Employee;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Collection;
    import java.util.ArrayList;
    public class EmployeeDAO {
         private Connection con;
         public EmployeeDAO(Connection con) {
              this.con = con;
         // METHOD FOR CREATING (INSERTING) A NEW EMPLOYEE
         public void create(Employee employee) throws CreateException {
              PreparedStatement psemployee = null;
              PreparedStatement psscheduleresource = null;
              String sqlemployee = "INSERT INTO employee (FIRSTNAME,SURNAME,GENDER) VALUES (?,?,?)";
              String sqlscheduleresource = "INSERT INTO scheduleresource (ITBCRATE,SKILLS) VALUES (?,?)";
              try {
                   if (con.isClosed()) {
                        throw new IllegalStateException("error.unexpected");
                            // Insert into employee table
                   psemployee = con.prepareStatement(sqlemployee);
                   psemployee.setString(1,employee.getFirstName());
                   psemployee.setString(2,employee.getSurname());
                   psemployee.setString(3,employee.getGender());
                            // Insert into scheduleresource table
                   psscheduleresource = con.prepareStatement(sqlscheduleresource);
                   psscheduleresource.setDouble(1,employee.getItbcRate());
                   psscheduleresource.setString(2,employee.getSkills());
                   if (psemployee.executeUpdate() != 1 && psscheduleresource.executeUpdate() != 1) {
                        throw new CreateException("error.create.employee");
              } catch (SQLException e) {
                   e.printStackTrace();
                   throw new RuntimeException("error.unexpected");
              } finally {
                   try {
                        if (psemployee != null && psscheduleresource != null)
                             psemployee.close();
                             psscheduleresource.close();
                   } catch (SQLException e) {
                        e.printStackTrace();
                        throw new RuntimeException("error.unexpected");
         }

    Hi ,
    U can use
    set Auto Commit function here ..
    let it be false first
    and when u do with u r all queries ..
    make it true
    this function take boolean values
    i e helful when u want record to be inserted in all or not at all..
    Hope it helps

  • 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

  • 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
    -------------------------------------------------------------------

  • Insert data into multiple tables

    Hi all,
    I've a requirement where i need to insert data into multiple tables using PL/SQL procedure
    Procedure should have two parameters
    1. Table Name (parameter1)
    2. Data (parameter2)
    Based on these two parameters i need to insert data into table (parameter1) using data (parameter2)
    ex:
    Procedure insert_data (p_table  IN VARCHAR2
                          ,p_data   IN -- what should be the datatype?
    IS
    l_statement VARCHAR2(2000);
    BEGIN
    -- insert data into tables
    INSERT INTO p_table
    values (....);
    END insert_data;Thanks in advance!!

    BEDE wrote:
    Amen to that!
    So, I believe a better approach would be the following...
    Suppose you have N datafiles with the same structure, and you wish to insert into the database the data from all those files.
    For that, you should have a single table, named, say incoming_file_data, which should be structured more or less like below:
    create table incoming_file_data (
    filename varchar2(250) not null -- name of the file inserted from
    ,file_time timestamp -- timestamp when the data was inserted
    ,... -- the columns of meaningful data contained in the lines of those files
    );And you will insert the data from all those files in this table, having normally one transaction for each file processed, for otherwise, when shit happens, some file may only get to be partially inserted into the table...
    Maybe one good approach would be to create dynamically an external table for the file to be loaded, and then execute dynamically insert select into the table I said, so that you will have only one insert select for one file instead of using utl_file... RTM on that.If the file structures are the same, and it's just the filename that's changing, I would have a single external table definition, and use the alter table ... location ... statement (through execute immediate) to change the filename(s) as appropriate before querying the data. Of course that's not scalable if there are multiple users intenting to use this, but generally when we talk about importing multiple files, it's a one-user/one-off/once-a-day type of scenario, so multi-user isn't a consideration.

  • Inserting Lots of fields into multiple tables

    Hi, i would like to enter lots of fields into mutiple tables
    in my access database. I have 6 pages which in turn have a
    different set of forms which must be inserted into its own table. I
    tried to insert some information into the table but because my
    database is a relational db i get an error message "You cannot add
    or change a record because a related record is required in table
    'Hosting'. Im not entirely sure what this error means but it is
    quite urgent that this is sorted. Another way in which i tried it
    was to carry all the form values over each page and recarry them
    onto the final 'insert' page but i cannot insert more than one
    insert record behavior and if i do i get a dim error message.
    Can somebody please help me this is very urgent.
    Thanks in advance,
    Adam

    Adam
    The error means that you are trying to insert a record into a
    table that is
    dependent upon some of the information being in a higher
    table, so you need
    to do the inserts in the correct order.
    There is an old tutorial on the MM site on how to handle
    multiple tabel
    inserts, which you may find useful.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "muzicmistro" <[email protected]> wrote in
    message
    news:e3fej1$8gp$[email protected]..
    > Hi, i would like to enter lots of fields into mutiple
    tables in my access
    > database. I have 6 pages which in turn have a different
    set of forms which
    > must
    > be inserted into its own table. I tried to insert some
    information into
    > the
    > table but because my database is a relational db i get
    an error message
    > "You
    > cannot add or change a record because a related record
    is required in
    > table
    > 'Hosting'. Im not entirely sure what this error means
    but it is quite
    > urgent
    > that this is sorted. Another way in which i tried it was
    to carry all the
    > form
    > values over each page and recarry them onto the final
    'insert' page but i
    > cannot insert more than one insert record behavior and
    if i do i get a dim
    > error message.
    >
    > Can somebody please help me this is very urgent.
    >
    > Thanks in advance,
    >
    > Adam
    >

  • 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.

  • How to insert one table data into multiple tables by using procedure?

    How to insert one table data into multiple tables by using procedure?

    Below is the simple procedure. Try the below
    CREATE OR REPLACE PROCEDURE test_proc
    AS
    BEGIN
    INSERT ALL
      INTO emp_test1
      INTO emp_test2
      SELECT * FROM emp;
    END;
    If you want more examples you can refer below link
    multi-table inserts in oracle 9i
    Message was edited by: 000000

Maybe you are looking for