How to insert into DB in batches using XSU

Hello,
I am inserting data from xml files into different tables .I have got four queries .I want to inert them using batch so that if in any query exception is raised,then whole thing is rollback.
Thanks in advance for any help.

Hi Linda,
Yes, it makes sense to do it this way... Otherwise there are lots of complications related to calling an insert statement or plsql pkg from code.
Questions:
1) Can anybody please paste dummy code to be written in AM?
2) How to add "AM Commit" from data controls to bindings? (When I click on the + button on my page definition select action it doesn't show 'Commit')
                                                                                       (The only way to add this action is by drag it and drop it as a button)
                                                                                       (How can I override action listener for this button since it would be #{bindings.Commit.execute})
                                                                                       (I am planning to add all my logic to collect attributes, insert in VO and execute commit in one button)
Thanks
Rahul

Similar Messages

  • How to select data from 3rd row of Excel to insert into Sql server table using ssis

    Hi,
    Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.

                                                         CUSTOMER DETAILS
                         REGION
    COL1        COL2        COL3       COL4           COL5          COL6          COL7
           COL8          COL9          COL10            COL11      
    1            XXX            yyyy         zzzz
    2            XXX            yyyy        zzzzz
    3           XXX            yyyy          zzzzz
    4          XXX             yyyy          zzzzz
    First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
    Set range within Excel command as per below
    See
    http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
    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 insert into a table with a nested table which refer to another table

    Hello everybody,
    As the title of this thread might not be very understandable, I'm going to explain it :
    In a context of a library, I have an object table about Book, and an object table about Subscriber.
    In the table Subscriber, I have a nested table modeling the Loan made by the subscriber.
    And finally, this nested table refers to the Book table.
    Here the code concerning the creation of theses tables :
    Book :
    create or replace type TBook as object
    number int,
    title varchar2(50)
    Loan :
    create or replace type TLoan as object
    book ref TBook,
    loaning_date date
    create or replace type NTLoan as table of TLoan;
    Subscriber :
    create or replace type TSubscriber as object
    sub_id int,
    name varchar2(25)
    loans NTLoan
    Now, my problem is how to insert into a table of TSubscriber... I tried this query, without any success...
    insert into OSubscriber values
    *(1, 'LEVEQUE', NTLoan(*
    select TLoan(ref(b), '10/03/85') from OBook b where b.number = 1)
    Of course, there is an occurrence of book in the table OBook with the number attribute 1.
    Oracle returned me this error :
    SQL error : ORA-00936: missing expression
    00936. 00000 - "missing expression"
    Thank you for your help

    1) NUMBER is a reserved word - you can't use it as identifier:
    SQL> create or replace type TBook as object
      2  (
      3  number int,
      4  title varchar2(50)
      5  );
      6  /
    Warning: Type created with compilation errors.
    SQL> show err
    Errors for TYPE TBOOK:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00330: invalid use of type name or subtype name2) Subquery must be enclosed in parenthesis:
    SQL> create table OSubscriber of TSubscriber
      2  nested table loans store as loans
      3  /
    Table created.
    SQL> create table OBook of TBook
      2  /
    Table created.
    SQL> insert
      2    into OBook
      3    values(
      4           1,
      5           'No Title'
      6          )
      7  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> insert into OSubscriber
      2    values(
      3           1,
      4           'LEVEQUE',
      5           NTLoan(
      6                  (select TLoan(ref(b),DATE '1985-10-03') from OBook b where b.num = 1)
      7                 )
      8          )
      9  /
    1 row created.
    SQL> select  *
      2    from  OSubscriber
      3  /
        SUB_ID NAME
    LOANS(BOOK, LOANING_DATE)
             1 LEVEQUE
    NTLOAN(TLOAN(000022020863025C8D48614D708DB5CD98524013DC88599E34C3D34E9B9DBA1418E49F1EB2, '03-OCT-85'))
    SQL> SY.

  • How to insert into a table in database1 from a table in database2?

    hi!
    how to insert into a table in database1 from a table in
    database2?
    can anyone help?
    Tariq.

    using the EXEC_SQL package.
    see form help for detail.
    Regards.

  • How to insert into more than one table at a time also..

    hi,
    i am a newbee.
    how to insert into more than one table at a time
    also
    how to get a autoincremented value of an id say transactionid for a particular accountid.
    pls assume table as
    transactionid accountid
    101 50
    102 30
    103 50
    104 35
    i want 102 for accountid 30 and 103 for accountid 50.
    thank u

    @blushadow,
    You can only insert into one table at a time. Take a look here :
    Re: insert into 2 tables
    @Raja,
    I want how to extract the last incremented value not to insert.Also, I don't understand your thread title... which was "how to insert into more than one table at a time also.. "
    Insert, extract... ? Can you clarify your job ?
    Nicolas.

  • How to insert into SQL server table form oracle forms

    I created a form with oracle as my database. But there one trigger where I need to insert the data into a sql server table.
    Is this possible. If so can any help me out.
    Thanks in advance.
    Asha

    Hi,
    You can insert into sql server database using the following steps
    Note: Check wether you are using Forms 32 bit drivers. If not the Odbc data source will not work.
    step 1: Create ODBC data source for SQL server(one time creation);
    step 2: Logout from Oracle and login to SQL server giving the user name,password and host string as odbc:<odbc datasource name>;
    step 3: use EXEC SQL statement to insert the values into the SQL server and then logout and login again to your oracle database.
    Second Method.
    Check the sql server documentation to insert the values using command line parameters. Then you can call the host command to execute this.
    Third Method.
    Write a VB exe to enter the values in the sql server making two connections one to oracle another to SQL server and then getting values from Oracle and putting in the SQL server database. You can call this exe using the Host command.
    Hope this will help You.
    Regards
    Gaurav Thakur

  • How to insert into a table from 3 tables?

    Hello,
    How to insert into a table getting values from 3 different tables?
    For example table_A has col_1 to col_10.
    I want to insert into table_A,
    values: col_1 to col_4 are from table_B,
    col_5 is from table_C,
    col_6 to col_10 are from table_D.
    Thanks!

    Normally, you'd do this by joining B, C, and D together. In the simplest case, something like
    INSERT INTO A( col1, ... col10 )
      SELECT B.col1, ..., B.col4,
             C.col5,
             D.col6, ..., D.col10
        FROM B,
             C,
             D,
       WHERE B.someKeyColumn = C.someKeyColumn
         AND C.anotherKeyColumn = D.anotherKeyColumnYou'd have to know how the data in B, C, and D relate to fill in the WHERE clause. This basically tells Oracle how to match the data in a particular row in B with the data in a particular row in C with the data in a particular row in D.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to INSERT into table using CORRELATED subquery

    I have 3 tables:
    1.TEMP_PHONE(person_id, phonenumber, phone_type) - this holds all phone numbers relating to a person(just a temporary holding area)
    2.PHONE_CONNECT(PERSON_ID, PHONE_ID) this table shows all the phone numbers relating to an individual. Phone_id is a unique number to identify a phonenumber and type(cell, work, home) - so in this table a person can have multiple phone ids)
    3.MASTER_PHONE(PHONE_ID, PHONENUMBER, PHONE_TYPE) this is a master phone table. each combination of phone number and type has a unique identifier-phone_id.
    What i need to figure out is how to populate PHONE_CONNECT with the information from TEMP_PHONE IF PERSON_ID already exists but phone_id is different. In other words, if the person gets a new phone number, i need to insert a new row into phone_connect.
    Before that step is started, the master_phone is populated first with a new phone_id associated to the phonenumber/type
    any help would be much appreciated. Thanks in advance.
    So far, this is what i have come up with, but not sure if it makes sense:
    insert into phone_connect(person_id)
    select a.person_id
    from temp_phone a
    where
    person_id = (select b.person_id from phone_connect b, master_phone c
    where
    a.person_id=b.person_id
    and b.phone_id <> c.phone_id
    and c.phonenumber||c.phone_type=a.phonenumber||a.phone_type);
    update phone_connect c
    set phone_id=(
    select b.phone_id
    from temp_phone a, master_phone b
    where a.person_id = c.person_id
    and a.phonenumber||a.phone_type = b.phonenumber||b.phone_type)
    where phone_id is null;

    It does. You are right. But that's what i need help with. I don't think my code is correct. After the insert, the code is actually updating the same exact record I just inserted. I'm sure this all can be done with one insert. I just really don't know how to show that in my code.
    I need to insert a new record into phone_connect with person_id and phone_id. phone_id is already populated in master_phone. I guess my problem is how to go about creating the joins to all three tables to make sure im inserting the data correctly, or not inserting data that already exists.

  • How to insert into database using jsp

    sir
    the code below is to enter the items in the database but it is giving the error .......of null.................
    <!-- JAI SHRI RAM -->
    <%@ page import="java.sql.*" %>
    <html>
    <head><title>JAI SHRI RAM</title></head>
    <body>
    <%
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");
    Statement st = conn.createStatement();
    for(int i=1 ; i<=13 ; i++)
    String skill_type = request.getParameter("skill_type"+i);
    String skill_name = request.getParameter("skill_name"+i);
    String version = request.getParameter("version"+i);
    String lastused = request.getParameter("last_used"+i);
    int last_used = Integer.parseInt(lastused);
    String proficiency_level = request.getParameter("proficiency_level"+i);
    String expinyears = request.getParameter("exp_in_years"+i);
    int exp_in_years = Integer.parseInt(expinyears);
    String expinmonths = request.getParameter("exp_in_months"+i);
    int exp_in_months = Integer.parseInt(expinmonths);
    String query = "insert into skills values(1 , '" + skill_type + "' , '" + skill_name + "', '" + version + "', 1 , '" + proficiency_level + "', 1 ,1)";
    st.executeUpdate(query);
    out.println("JAI SHRI RAM ,,,,,,,, transcation is over");
    %>
    </body>
    </html>
    i m using MS ACCESS
    please tell me the problem
    thank you
    gaurav

    Hi,
    Most probably you have problem in proper initialization of the database driver or the connection url.
    In lines shown bellow
    String url = "jdbc:odbc:lala" ;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection(url,"","");Try to do that with more simple operations e.g. insert in a table with one field.

  • How to insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • ORA-22275 inserting into the CLOB column using ODBC input parameters

    Hi all,
    I'm having problem with INSERT into the CLOB column via bound input parameters.
    After calling SQLExecDirect() I'm getting following error:
    [Oracle][ODBC][Ora]ORA-22275: invalid LOB locator specified
    Adding defaults to the table definitions does not help. If I embed parameter values into the SQL statement - everything works just fine.
    I use Oracle 9.2 with latest Oracle ODBC driver 9.2.0.4 under Windows XP.
    Any ideas appreciated...
    Vlad
    Code looks like this:
    SQLBindParameter(hstmt,1,...);
    SQLBindParameter(hstmt,2,...);
    SQLBindParameter(hstmt,3,...);
    SQLExecDirect(hstmt,...);
    SQL statement looks like this:
    insert into tst_table (id,str_fld,clob_fld1,clob_fld2) values (50, ? , ? , ?)
    Table looks like this:
    CREATE TABLE tst_table (
         id          number (10,0)     NOT NULL ,
         str_fld          nvarchar2 (50)     NOT NULL ,
         clob_fld1     nclob          NOT NULL ,
         clob_fld2     nclob          NOT NULL ,
         CONSTRAINT PK_tst_table PRIMARY KEY
              id
    I tried to add defaults to the table, but result is the same:
    CREATE TABLE tst_table (
         id          number (10,0)               NOT NULL ,
         str_fld          nvarchar2 (50)               NOT NULL ,
         clob_fld1     nclob     default EMPTY_CLOB()     NOT NULL ,
         clob_fld2     nclob     default EMPTY_CLOB()     NOT NULL ,
         CONSTRAINT PK_tst_table PRIMARY KEY
              id

    You need to provide the data at execution time (i.e. SQL_LEN_DATA_AT_EXEC(0) in the SQLBindParameter followed by a series of SQLPutData calls). If you go to Metalink
    Top Tech Docs | Oracle ODBC Driver | Scripts & Sample Code
    has some sample code that shows you how to do this.
    Justin

  • How to insert into table from an Datatable ?

    Hi Friend,
    I have a datatable that is created at some point in my SSIS as an object.
    I need to insert the data into a sql table, how should I do that ?
    I have this:
            Dim oleDA As New OleDbDataAdapter
            Dim dt As New DataTable
            Dim col As DataColumn
            Dim row As DataRow
            Dim sMsg As String
            oleDA.Fill(dt, Dts.Variables("history").Value
    and want to insert into a table in a SQL DB
            Dim sqlCon As New SqlClient.SqlConnection("server=Myserver\SQL2008R2;database=MyDB;Integrated Security=SSPI")
            Dim sqlreader As SqlClient.SqlDataReader
            sqlCon.Open()
    Thanks in advance,
    Pat
    Patrick Alexander

    Convert it to a ADO .Net recordset and store it in a object variable in SSIS.
    Then you can use it to populate the table using foreach loop with ado enumerator
    http://www.codeproject.com/Articles/10503/Simplest-code-to-convert-an-ADO-NET-DataTable-to-a
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to INSERT INTO a specific row?

    I have a form with a calendar at the top, below it is a list of items each with a check box.
    Here is a wonderful visual of it -
    Calendar
    Checkbox | Col | Col | Col
    Checkbox | Col | Col | Col
    Checkbox | Col | Col | Col
    I want it so you select the date and it gets passed into the database in the same row as the one (definitely one, multiple is better) that has been checked by the user.
    I was trying an INSERT INTO with a WHERE statement but apparently you can't do that. So if I can use a WHERE with INSERT INTO, how can I identify which row to insert the info?
    Currently it is passing the dates but it creates a new row.
    I didn't think posting the code is neccisary for this question but if anyone wants to see it let me know and I will post it.
    THANKS!

    Ah, ok, I will try UPDATE.
    Right now my form looks like this...
    <cfform name="requestform" role="form"action="resources/requestform.cfm" method="post"  width="375" height="350" >
        <label for="startdate">Start Date:</label>
          <label for="enddate">Finish Date:</label>
        <cfcalendar name="selectedDate" 
            selectedDate="#Form.selectdate#"
            startRange="#Form.startdate#"
            endRange="#Form.enddate#" 
            mask="mmm dd, yyyy" 
            dayNames="SU,MO,TU,WE,TH,FR,SA"
            firstDayOfWeek="1"
            monthNames="JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC"
            style="rollOverColor:##FF0000"
            width="200" height="150">
                <cfinput type="dateField" name="startdate" label="Start Date" width="100" value="#Form.startdate#">
                <cfinput type="dateField" name="enddate" label="End Date" width="100" value="#Form.enddate#">
        </div>
    <cfinclude
        template = "resources/query.cfm">
        <span class="label label-default">Equipment List</span>
        <table class="table table-bordered table-striped">
            <tr>
                <td><b>Select</b></td>   
                <td><b>Name</b></td>
                <td><b>Description</b></td>
                <td><b>Status</b></td>
            </tr>
        <cfloop query = "equiplist">
            <cfoutput>
            <tr>
                <td>
                    <cfinput name="status" type="checkbox" value="#serial#">Select:</cfinput>
                    <cfinput name="serial"type="text"style="display:none" value="#serial#">
                </td>   
                <td>#name#</td>
                <td>#descrip#</td>
                <td>#status#</td>
            </tr>
            </cfoutput>
    </cfloop>
    </table>
          <cfinput class="btn btn-default" type="Submit" value="Submit" name="addsubmit"></cfinput>
    </cfform>
    And the action page looks like this...
    <cfquery
            name = "requestform"
            dataSource = "db_cie">
            UPDATE equip
            SET STATUS="Out",
            WHERE serial='#status#'
    </cfquery>
    <cflocation
        url = "../request.cfm">
    But I am getting an error "invalid.user.table.column, table.column, or table specification. But the error message shows the SQL output and it looks correct...UPDATE equip SET STATUS="Out" WHERE serial="325255"... it IS getting the serial number variable passed from the form. ...No update though. Is my action form written wrong?

  • How to insert into mysql the creation time and modification time from java?

    first how?
    Second what is better from create the date from java or do it from mysql?
    thanks in advace
    Pedro

    One way is to use the GetDate function in mysql. This will set the date as you insert data. insert into table(date) values(getdate())
    Anytime you modifiy the table just call the function again and update its fields.
    Dont know which is beter to do. In java or on the database side.

Maybe you are looking for

  • Final Cut No Go After 5.1.2 upgrade

    Hi Guys & Girls To make it short... I upgraded to FCP 5.0... ok..so far so good Then I upgraded to Tiger 10.4 and upgraded off the net the apple updates to make it 10.4.8 again..so far so good.. I thought until I opened FCP to finish some work FCP wo

  • Assigning a Constant Value for Target Revenue

    Hello all, I have a scenario where I need to assign a Constant value, say 10000, for my Target revenue Key Figure at the Info Cube level. This value should always be 10000. Please advice. Your valuable suggestions will be greatly appreciated. I will

  • Oracle BPM installed  Java out-of-memory exception

    Hi, I have installed the oracle BPM software in the server have the Ram capacity 8 GB,Could you please suggest some of the do's and don't's to avoid the Java out-of-memory exception which normally appearing on the console of weblogic server. My Serve

  • Appending results returned by multiple queries into 1 row?

    I have multiple select queries in a procedure. Each query processes different tables and returns one or two columns that need to be inserted to a staging table. The results of these queries should be appended to one row. select col1, col2 from table1

  • How to install Cyrillic package SUNWi5rf from Installation disk?

    Hello! I am a new to Solaris. I have a spark server with Solaris 9 already installed with West-european locales. But I need for work East-european iso8859-5. I know that it is SUNWi5rf. I found it on installation disk 1 Solaris 9. Server is situated