How to insert multiple rows in same table at once

hi ,
How can I insert more than one row in the same database table on single submit button.
(i am using the ADF , EJB and Toplink for this example.)
EMPLOYEEand DEPARTMENT tables will hold a common coloum deptno
The method I have tried is as follows.
I have created the UI that holds EMPLOYEE(DETAIL) details and a DEPARTMENT(MASTER) table and I have created two separate bean classes which hold the getters and setters for the corresponding tables.
I have created a method in Department bean which will be called when we add the employee details
public String addEmpdetails() {
this.employeedetailslist.add(empdetails);
return null;
where employeedetailslist is a Arraylist and I want to pass the reference of employeebean in the array list.
But this method will fail as I need to create the new employee bean object every time when ever I need to pass.
How can I store values of multiple rows in bean.
In the EJB session bean how can I commit multiple EMPLOYEE rows and DEPARTMENT values at once.

The use of &variable in a script is actually syntax for a "substitution variable" in the SQL*Plus tool (other tools may also do the same), not an inherent part of SQL or PL/SQL itself.
Whenever SQL*Plus is given a script it parses through it and if it encounters one of these it prompts for a value. This value is then substituted into the script before the script actually get's sent to the SQL or PL/SQL engine (process) on the database server. Once the script has gone to the database server it executes there and the results are passed back for SQL*Plus to display. However, the SQL and PL/SQL processes on the database server have no way to interface to the client machine, so they themselves cannot prompt for input from the client and you can't expect to prompt inside a loop as you are doing.
What you need is a user interface on the client that can prompt repeatedly for values and then re-send the script, or call a procedure on the database each time. This can be done using shell scripts or dos batch files (depending on your client being unix/dos based) or using a front end application tool such as Java, .NET, Powerbuilder, PHP, Application Express (APEX) etc.

Similar Messages

  • Inserting multiple rows in child table

    i have two entity beans (main and child) with relationship one to many .... when i insert one row in main table (ie when i make one object for main entity bean)... how to insert multiple rows in child table...

    Can anyone pls provide some sample code for the above.. how to pass a collection and populate it in the child table.
    1.Where to pass the collection, to the childbean directly or to the parent bean and then itereate to the collectio and create child bean.
    Much obliged if you could paste some code for the above..

  • Inserting Multiple Rows in a table

    Hello,
    I need to insert multiple rows in a table with the selected items from a list (Multiple select).
    How do i go about it. I'm using ADF-struts-UIX application on Jdeveloper 9.0.5.2
    Thanks.

    Jonas, I've downloaded the sample application from your ADF UIX Editable table tip but have some problems.
    I can't even open the emp.table.uix file - errors are:
    Parsing error. Unable to parse binding.
    javax.servlet.jst.el.ELException:Function ctrl:createSortableHeaderModel was not found.
    and
    javax.servlet.jst.el.ELException:Function ctrl:getSortOrder was not found.
    Also - is there a place in the sample where you define the sample tables? They do not seem to match the standard sample emp table, for instance.
    I've just started using JDeveloper and would like to use the solution.
    Thanks - Linda

  • Inserting multiples rows into a table using function or procedure..

    How do i insert multiples rows into a table using function or procedure?
    Please provide me query..

    Use FORALL bulk insert statement...
    eg:
    procedure generate_test_data as
    type cl_itab is table of integer index by pls_integer;
    v_cl_itab cl_itab;
    type cl_vtab is table of varchar2(25) index by pls_integer;
    v_cl_vtab cl_vtab;
    type cl_dtab is table of date index by pls_integer;
    v_cl_dtab cl_dtab;
    begin
    for i in 1.. 100 loop
              v_cl_itab(i):= dbms_random.value(1,1000);
              v_cl_vtab (i):=dbms_random.string('a',20);
              v_cl_dtab (i):=to_date(trunc(dbms_random.value(2453737, 2454101)),'j');          
         end loop;
         forall i in v_cl_itab.first .. v_cl_itab.last
              execute immediate 'insert into test_order values( :n, :str , :dt ) ' using v_cl_itab(i), v_cl_vtab (i), v_cl_dtab (i);          
         commit;
    end;

  • How to insert multiple rows in a single shot using insert command?

    Hi,
    If we insert one row, we can use "insert into" command. I want to insert multiple rows into the table in a single shot. Is there any SQL command for insert multiple rows into the table?
    Plese give the solution.
    Thanks,
    chelladurai

    If you would like to do it with SQL, this would be one of the ways to achive it:
    SQL*Plus: Release 10.2.0.4.0 - Production on Fri Sep 25 10:12:59 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, Data Mining and Real Application Testing options
    SQL>
    SQL> desc leap
    Name                                      Null?    Type
    FIRST_PRICE                                        NUMBER(16,6)
    NEXT_PRICE                                         NUMBER(16,6)
    SQL>
    SQL> select * from leap;
    no rows selected
    SQL>
    SQL>
    SQL> !vi multirow_insert.sql
    SQL> !cat multirow_insert.sql
    insert into leap(first_price, next_price) values (1,2);
    insert into leap(first_price, next_price) values (3,4);
    insert into leap(first_price, next_price) values (5,6);
    SQL>
    SQL> @multirow_insert.sql
    1 row created.
    1 row created.
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL>
    SQL> select * from leap;
    FIRST_PRICE NEXT_PRICE
              1          2
              3          4
              5          6
    SQL>

  • Insert multiple rows in a table

    Hello Apex expert,
    I need help on insert multiple rows. it may look easy but I don't know how to do it.
    I have a table (with name found_table) which has these fields: found_ item_id, item_name, current_location, cost_center, tag_number. Also, I have a table (with the name transition) which has these fields: transition_id, found_item_id (FK to found_table), from_location, to_location, From_cost_center, to_cost_center, tag_number.
    I have an interactive report on found_table which I would like to add checkbox to all rows of the report. When the user checks any rows and press submit, I would like to send all these selected rows to another page which I have a form on transition table. The user will select a to_location and to_cost_center from this page (by the way from_location and from_cost_center and tag_number is the same as current_location and cost_center, tag_nuber from found_table, which I figured it out how to show those as a default in the new form). Now I want when a user selects the new location and cost center and press submit, all those selected rows be inserted in transition table with new locations.
    I read several threads on forum, but I could not find a solution for my problem. I will appreciate your help.
    Thanks,
    Atousa

    Hello again,
    I created a report with check box. I also added two selected list at the top of the region to select the location and cost center. Also, there is a transfer button(as submit) to insert the new data to table. Now I need the insert process. I tried different insert process but none of them is working for me:(((
    I created an example of what I need to do in the apex that you can take a look and give me some advise. The link is:
    What I need to do is:
    When a user selects several rows by using checkbox and selects To_LOCATION, and TO_COST_CENTER from selected list, and clicks on transfer, all the data should be insert in to another table with the name transition as follows:
    from found table to transition table
    found_item_id(pk) found_item_id (fk)
    current_location from_location
    cost_center from_cost_center
    tag_number tag_number
    selected list (to_location) to_location
    selected list (to_cost_center) to_cost_center
    Please help me on that. I appreciated.
    Atousa
    Edited by: Atousa.M on Jul 21, 2011 10:55 AM

  • Inserting multiple rows into a table using a multiple-select list

    I'm trying to figure out how to take the output of a multiple-select list (":" separated list of values) and use that to update a table by inserting multiple rows based on the values. Is there a straight-forward way to do that in APEX?
    Thanks.
    Chris

    Hi Chris,
    I think this should give you what you need: Working with a Multiple Select List Item
    --Jennifer                                                                                                                                                                                                                                                                                                                                                                                                   

  • Inserting multiple rows into a table (using sequences)

    Hi!
    I want to insert multiple rows into a db table, but I don't know how.
    I know how to insert 1 row using a sequence:
    I put all the fields in the jsp form's page and in the submit page I put something like this:
    <jbo:Row id="myRow" datasource="ds" action="Update" rowkeyparam="MyRowKey" >
    <jbo:SetAttribute dataitem="*" />
    </jbo:Row>
    But how can I insert multiple rows like this:
    Id          Name
    1          ana
    2          monteiro
    3          maria
    Thanks!

    Hi Chris,
    I think this should give you what you need: Working with a Multiple Select List Item
    --Jennifer                                                                                                                                                                                                                                                                                                                                                                                                   

  • Inserting Multiple Rows into a Table

    I am having problems insert multiple rows. I am using Table1.Row1.instanceManger.addInstance(1).
    I try adding another line using
    Table1.Row2.Cell2.value.#text= "TEST"
    and I get an error acessor is unknown. I assume this is an index issue. Can someone tell me if I am doing this wrong and discuss table indexes?

    The first thing I notice is that your variable, "num," isn't initialized in the FOR loop like I'm used to seeing.. The next thing I would try would be declaring my variables outside of the loop. Something like this maybe.
    String query = null;
    Statement stmt = null;
    int rowsUpdated = 0;
    for (int num = 0; num < 10; num++);     {
         query = "INSERT into apartment (apartmentID,blockID) VALUES ('"+num+"','"+aid+"')";
         stmt = con.createStatement();
         rowsUpdated += stmt.executeUpdate(query);
    }Let me know how it goes.
    -Aaron
    http://www.WeKnowErrors.com/ A free Wiki for error codes and computer problems.

  • How to delete multiple rows from ADF table

    How to delete multiple rows from ADF table

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency

    I need to insert multiple rows into a database table using the JDBC adapter (receiver).
    I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
    Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?

    Hi Bhavesh/Kanwaljit,
    If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
    Why i am saying this?
    If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
    <i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
    Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
    Doesnt this mean that rows are inserted one by one?
    Correct me if i am wrong.
    This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
    Regards,
    Sumit

  • How to insert multiple rows in oracle forms when using TEMPLATE FORM

    I got a case study on PO creation nd in that I have to insert multiple rows in form especally when PO creation screen is there.
    I tried by different syntaxes but its not working.I need correct syntax to insert the multiple rows in to the table in oracle forms

    Please Oracle EBS queries on EBS forums.

  • *a bit urgent * How to take multiple rows of same input?

    Hi,
    I need to make an user interface which takes multiple rows of same input.
    For eg.. online eGreetings sites..
    You select the the number of eCard receipents froma drop down and the page refreshes and that many number of text fields appear.. where you can put in multiple addresses..
    Its like a dataTable.. but instead of showing the data it should input data...in each row
    I hope I could clarify myself..
    I would like to know
    - how to map the fields to the managed bean
    - how to create the user interface
    Some could be appreciated..
    Thanks and regards

    arijit_datta wrote:
    Its like a dataTable.. but instead of showing the data it should input data...in each rowThen just change h:outputText by h:inputText?

  • Insert multiple rows in on table and retreive sequence values

    Hello,
    I'm searching a way to insert several rows in a table that needs a sequence and retreive its.
    For one row i use ExecuteScalar method with the following SQL is :
    INSERT INTO MY_TABLE(MY_PK)
    VALUES(SEQ_MY_TABLE.NEXTVAL) RETURNING MY_PK INTO :MY_PARAMETER
    The aim is to insert several rows at one time. Currently I execute this SQL :
    INSERT INTO MY_TABLE(MY_PK, MY_VALUE)
    SELECT SEQ_MY_TABLE.NEXTVAL, MY_VALUE
    FROM (
    SELECT 0 MY_VALUE FROM DUAL UNION ALL
    SELECT 1 MY_VALUE FROM DUAL
    This query works well but i'm wondering how to retreive all sequence values generated by this query.
    Is it possible and how ?
    Thank you.
    Sebastien

    I tried this :
    string sql = "INSERT INTO MY_TABLE(MY_PK, MY_VALUE) " +
    "SELECT SEQ_MY_TABLE.NEXTVAL MY_PK, MY_VALUE FROM ( " +
    "SELECT 0 MY_VALUE UNION ALL " +
    "SELECT 1 MY_VALUE) " +
    "RETURNING MY_PK BULL COLLECT INTO : RETURN_IDS";
    using(var manager = myFactory.CreateDbManager()) // Initializes the connection and encapsulates ADO objects
    manager.SetCommand(sql);
    var cmd = (OracleCommand)manager.Command;
    cmd.ArrayBindCount = 2;
    var p = new OracleParameter();
    p.DbType = DbType.Int64;
    p.ParameterName = "RETURN_IDS";
    p.Direction = ParameterDirection.Output;
    p.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p.Size = 2*sizeof (long);
    cmd.Parameters.Add(p);
    cmd.ExecuteNonQuery();
    var result = (Oracle.DataAccess.Types.OracleDecimal[])p.Value;
    But I have an error ORA-00933 that indicates that the query is wrong at "RETURNING MY_PK".
    .......................................................................................................^
    Edited by: CITnDev on 1 août 2012 13:00
    Edited by: CITnDev on 1 août 2012 15:10

  • How to insert multiple rows in a single insert statement in MaxDB?

    hi,
    I was looking at syntax but i could not get it right.. may be some could help me.
    // Insert single row works fine
    INSET INTO test_table(column_name) values (value1) IGNORE DUPLICATES
    // Insert multiple rows, doesn't
    INSET INTO test_table(column_name) values (value1), (value2), (value3) IGNORE DUPLICATES
    Can somebody help me with this.
    thanks,
    sudhir.

    Multiple inserts do only work with parametrized statements, usually used in interfaces like JDBC, ODBC etc.
    With static SQL statements it is not possible.
    Regards Thomas

Maybe you are looking for