How to insert rows in multiple tables in a sql

I want to know how to insert multiple lines in a single sql statement.

Let's insert records into the table emp and dept in a sql statement.


Thank you

It's here

SQL>l
  1  insert all
  2    into emp values(8888,'WADE','MANAGER',7839,'01-MAR-2008',5000,100,20)
  3    into dept values(50,'MARKETING','NEW YORK')
  4* select * from dual
SQL> /

2 rows created.

SS

Tags: Database

Similar Questions

  • How to insert rows in the table dynamically?

    I have a table with 18 ranks. Each of the first 17 rows have text read-only (mandatory activities) in a text field in the first column; the last line is a blank line with an Add button so that the user can add a new activity to the bottom of the table.

    I was invited to allow users to insert a new activity at any location in the table (by example, to insert a new 7 row after row 6), instead of just at the end of the table. (Of course this requires also remove the text in the text box of the activity and to change to the entry by the user, as well as a few other household activities, which should not be a problem if I can get just the line darn insert!)

    I searched the forums and looked at some of the examples ensure dynamics. From what I've seen, this should be fairly simple... but it does not work.

    Or rather, it works very well on the first line, several times even. I have a message box displays the indices of current and new line properly for each line. But in any other line as the first, insertInstance() gives me an error "index value is out of range" even when the message box displays the correct clues.

    Given the structure and the following code in each button an ActivityAdd line, can someone tell me what I'm doing wrong? Thank you!!!

    -------------------------------------------

    tableStructure.png

    ---------------------------------------------

    T_Activities.R_Activity [0]. T_AddRemove.R_Add.B_ActivityAdd::click - (JavaScript, client)

    var vNewRowIndex = this.parent.parent.parent.index + 1;

    xfa.host.messageBox ("the index of this line:" + this.parent.parent.parent.index + ".") Index of the new row: "+ vNewRowIndex +". ");"

    T_Activities.R_Activity.instanceManager.insertInstance (vNewRowIndex, 1);

    ------------------------------------------------

    FWIW, I've seen the warnings about the instance manager and features underscores in names of object... for better or worse, * all * of my names object * all * of my forms use underscores like this, and to the best of my knowledge I have never had a problem. So which proves to be the problem here, I'll gladly change the names in the table.

    Did you use java or formcalc when you got the error? I've recreated your table and the code works in formcalc.

    Concerning the insertIndex working in the first line, I think that maybe it's because you always refer to the first line (R_Activity).

  • insertion in a nested table of pl/sql

    worm 10.2.0.3

    I know that I can do this in the example with a big collect but in the 'real' code, I have to be inserted...

    My question is how to insert in a nested table of pl/sql?
    create or replace type all_obj_obj as object(owner varchar2(30),object_name varchar2(30),object_type varchar2(30))
    /
    
    create or replace type all_obj_list as table of all_obj_obj
    /
    
    declare
     coll  all_obj_list := all_obj_list();
    begin
     insert into table(coll) select owner,object_name,object_type from all_objects;
    end;
    / 
    I know that could do a select master, object_name, object_type bulk collect in coll but I do an insert for some reason as long as I can go in... anyway to do it?

    Your "nested table" is not a "nested table" but a collection, a varable.
    Obviously so can not INSERT in a memory structure.
    Your need is not supposed, as BULK COLLECT would do the tric.
    As you cannot disclose why you ' need; for this (you do not have) and also do not mention a version, as you ' assume; PL/SQL does not ever change or everyone uses the same version, no additional help is possible.

    -----
    Sybrand Bakker
    Senior Oracle DBA

  • Need help to insert rows in the table to a custom table area

    Hi all

    I have a requirement as below.

    I have a page of the i invoke a popup search page and displaying the table data in the area of the table, this table I select lines and pressing the button and given in the basic page in the region of the table being filled, of data, I need to insert these lines into a custom table. Please help me how to achieve this. Basically, I need to insert rows from one table to a custom table region.

    Thnaks

    Hello

    Review the link, below, may be it will help you:

    https://forums.Oracle.com/thread/953885

    https://forums.Oracle.com/thread/2151775

    Please share your solution here, it will help others.

    Concerning

    Mahesh

  • Error when inserting rows into a table

    Hello

    We have recently migrated to 9i and 10g. We have a scheduled task on our database who first removes all rows from a table and then inserts them back by selecting the lines of 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when I try to insert rows in the table after you remove all of the lines, I am able to insert the data successfully. However, in 10g, when I try to do the same operation, it fails with error ORA:

    ORA-00001: unique constraint violated

    The same query that works perfectly in 9i fails in 10g

    If anyone has some ideas on how to solve the same, kindly let me know.

    Thanks in advance.

    CrazyAnie wrote:
    Okay, so now the only option that remains is that I have load the data into a local table and then perform the loading.

    May not be the only option, but the safest and cleanest I would say.

    CrazyAnie wrote:
    Also, it would be very kind of you that you might suggest all other possible risk areas where this CHARSET conversion could be a concern.

    I imagine that the main areas of concern will be you are interfacing directly with other databases through database links and using string functions. Otherwise, as long as the manipulation of data is in the same database 10g should not be a problem.

    CrazyAnie wrote:
    I made the migration of my source 9i DB, which is on Solaris to my 10g database which is on Linux and a separate server (which resides in a completely different location) uses exp and IMP. So if I try to export my schema after you change the CHARACTER set and then import it into the target DB, should that help me to get rid of this error? What is an option that can be done?

    I don't think it would be that simple change your database character set, check out this link for discussions about the same:

    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:5783936214008]

  • How to insert rows in Board signout to recurring weekly entires

    I need help for create a simple procedure for lines inserted in the Council Signout database for entries "recurring weekly.
    The schema is SIGNOUT in the DEV10G database.
    There are three main tables: UKIMR, the REASONand SIGNOUT
    My first thought is that the procedure takes as arguments:
    -name, surname
    -first name
    -start date
    -number of weeks
    -the type of entry (for example, "telecommuting")
    -Comment
    Note: I use the name as args because that's how columns are configured in the UKIMR table.
    So all it would do is create entries on the same day-of-the-week as the * 'start date' * for as many weeks as you indicate in the * 'number of weeks' * argument.
    So this would be an example of calling script:_
    * exec STP_InsertWeekly ("Lastname", "firstname", October 3, 2008 ', 5, 'Teleworking', null);
    Which would insert 5 rows SIGNOUT for 5 Friday October.

    Published by: user4653174 on October 3, 2008 10:28

    Published by: user4653174 on October 3, 2008 10:29

    Published by: user4653174 on October 3, 2008 10:31

    user4653174 wrote:
    I want to see my procedure to insert rows in the table SIGNOUT. When I run that it is has the below error. The purpose of this procedure is for the employee to enter their name, the date they want to be turned off or work from home, or anything else, until they start, number of weeks (which will determine the number of rows will be inserted each week is a line), and comments that's what they do.

    Interaction with the customer as request for input values, is done in a client tool such as SQL * Plus or web applications. Not in PL/SQL. This just PL/SQL procedure accepts input parameters and can be called from a client application.

    The no data found error is due to a select... IN the statement, which fails to extract a single line. You must decide what you want your procedure to be done in this case. Ignore, not, one other message ease of use or...?

    And please paste formatted code using code tags. You have been told several times now, please the Act itself.

    Kind regards
    Rob.

  • Use with need to collect in bulk to insert records from multiple tables

    Hello

    I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.

    Please give me suggestions.

    ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.

    Example 1 (dynamic SQL):

    begin

      ...

      forall i in vRecList.First..vRecList.Last
        execute immediate '
        begin
          insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
          insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
        end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
    end;

    Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions.  In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.


    Example 2 (insert all):

    begin

      ...

      forall i in vRecList.First..vRecList.Last

        insert all

          into Table1 values vRecList(i)
          into Table2 values vRecList(i)
        select 1 from dual;

    end;

  • Number of rows in multiple tables

    Hello

    Im trying to count the rows of multiple tables

    for example I need the select statement to produce the following

    County of table_name
    Table1: 5
    Table2 6
    3 3 table


    I came up with the following script, but it counts the number of tables that I

    Select object_name, (select count (*) from user_tables where table_name = object_name) to object
    where type_objet = 'TABLE '.

    Hello

    Use this query

    Select table_name, num_rows from user_tables

    He he's useful to you.

  • How to insert data into the table by using the expression builder in the assign activity

    How to insert data into the table by using the expression builder in affect business in BPEl, I use SOA Suite 11.1.1.5
    Can someone help me please

    Hello

    I don't think that oraext:query-database() can insert data into the table.

    What are your needs?
    Can not you plan to use the DB adapter with the insert operation?

    Kind regards
    Neeraj Sehgal

  • Impossible to insert rows in the table

    My insert statement below is not correct, when I try to run, his encoutering error "table or view does not exist.

    Basically what I'm doing here collects the table name in THE variable that stores the name of the table in this variable. This variable, I use as a table. I know that's not the right way, please let me how can I insert rows in the complete table with the following code.

    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM model WHERE 1 = 2;
    DECLARE
    I HAVE INTEGER DEFAULT 1;
    S VARCHAR2 (50);
    Start
    for C (select TABLE_NAME IN s from USER_TABLES where TABLE_NAME like '% of the CABLE' and TABLE_NAME NOT like '% OLD' and the order of 0 > Num_ROWS by TABLE_NAME) loop
    INSERT INTO TEMP SELECT * FROM c.TABLE_NAME;

    dbms_output.put_line (c.table_name);
    end loop;
    end;



    The insert statement above is not correct. How can I write good way.

    Thank you.

    Best regards
    Arshad

    user13360241 wrote:
    My insert statement below is not correct, when I try to run, his encoutering error "table or view does not exist.

    Basically what I'm doing here collects the table name in THE variable that stores the name of the table in this variable. This variable, I use as a table. I know that's not the right way, please let me how can I insert rows in the complete table with the following code.

    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM model WHERE 1 = 2;
    DECLARE
    I HAVE INTEGER DEFAULT 1;
    S VARCHAR2 (50);
    Start
    for C (select TABLE_NAME IN s from USER_TABLES where TABLE_NAME like '% of the CABLE' and TABLE_NAME NOT like '% OLD' and order > 0 Num_ROWS of TABLE_NAME) loop
    INSERT INTO TEMP SELECT * FROM c.TABLE_NAME;

    dbms_output.put_line (c.table_name);
    end loop;
    end;

    The insert statement above is not correct. How can I write good way.

    Thank you.

    Best regards
    Arshad

    STMT: = "INSERT INTO TEMP SELECT * FROM ';"

    STMT: = STMT. S;
    IMMEDIATELY EXECUTE STMT;

  • How to insert image bg in table?

    Hello, I followed this tutorial of training from someone who is using Dreamweaver 8. He tells me to select the table and simply scroll the bg folder in the properties panel and upload your image of bg. In my Dreamweaver CC, I choose the table easily enough, but the bg folder won't. Can you please tell me how to insert a bg image in a table?

    Thank you.

    As DW 8 is more than 10 years old, I would not consider using a tutorial that has been prepared using this version. And use tables for layout is certainly not the way to go, either. The right way to proceed would be to use CSS to specify the background image for an element of your page. In this way, the specification of the background is not part of the content of your page, but can reside in an external file that is linked.

    Tell us please what your skill level is with HTML and CSS. Perhaps is that a day spent running through the tutorials at http://www.html.netor http://www.w3schools.com is everything you need to get in tune. It is true that the more you know about HTML and CSS, the simplest DW will be using...

  • How to insert the value of table display

    Hi all

    I have a page element named that email and set this as view only, now I need to insert this value in the table I use insert statement like this: P255_EMAIL, but it gives an error.


    Can someone tell me how to insert this

    Thanks and greetings
    srikkanth. M

    Srikkanth,
    A single display element is not rendered at the point of entry to the difference of the other editable on the page elements, if you look at the html code of any view one item and compare it with a textfield should be clear.

    You can have another element hidden with the value that can be returned in the process
    OR

    Here's a little something that does not need any additional items to make the item view alone and still available in the world as a normal part

    Do not say P100_MY_ITEM like a textfield
    But in the text of element Pre_ give you

    <span class="display_only" >&P100_MY_ITEM.</span><span style="display:none">
    

    And in the text of item Post_ put

    </span>
    

    Hide the textfield object, it shows the value of the item as a single text to display.

  • How to insert records into a table from a button?

    Hey,.

    I use Oracle form and I have a trigger button when button pressed.

    I have a project being given for one of my classes. Basically, I have a Customers table and they hit the news. When they press submit, it must insert it into the table.

    And here is the code I wrote to be inserted inside the button

    declare


    v_cust_id customer_detail.customer_id%type;

    v_f_name customer_detail.fname%type;

    v_l_name customer_detail.lname%type;

    v_destination customer_detail.destination%type;

    v_travel_date customer_detail.travel_date%type;

    v_address customer_detail.address%type;

    v_telephone customer_detail.telephone%type;


    Start

    insert into customer_detail

    values (v_customer_id, v_fname, v_l_name, v_destination, v_travel_date, v_address, v_telephone);

    end;

    /


    But its gives me an error. Is a PLsql Oracle form different syntax?

    Why do you need to insert in the command, when applications oracle has this native features?

    Make a form based on the table and just use

    COMMIT_FORM; on your BUTTON.

    Hope this helps

    Hamid

  • How to insert data into a BLOB column using sql

    Hi all

    How to insert data into the BLOB column directly using sql.
    create  table temp
    (
      a blob,
      b clob);
    
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
                                      *
    ERROR at line 1:
    ORA-01465: invalid hex number
    
    Please help in this.
    Thank you
    Prakash P

    Insert into temporary values (UTL_RAW. CAST_TO_RAW ('32aasdasdsdasdasd4e32'), 'adsfbsdkjf');

  • How to insert a 1 d table row in a 2D array?

    I have a vi that acquire several pulse encoder signals and store it in a 1 d table, and I want to move the data to a 2d array and fill it. I mean I want to acquire the signal and keep in line 1 of table 2d and keep in line 2 of the 2d table build again and keep it successively.

    How can I do?

    Many ways... same result. The first and the last are more effective.

Maybe you are looking for