ORACLE
ORACLE QUERIES
SELECT
INSERT
INSERT ALL
UPDATE
DELETE
TRUNCATE TABLE
ORACLE TUTORIAL
Oracle Introduction
What Is Oracle
ORACLE TABLES
Create Tables
Create Table As
Alter Table
Drop Table
Global Temorary Tables
Local Temorary Tables
ORACLE VIEWS
Create View
ORACLE CLAUSES
DISTINCT
FROM
ORDER BY
GROUP BY
HAVING
ORACLE OPERATORS
UNION
UNION ALL
INTERSECT
MINUS
ORACLE JOINS
INNER JOIN
OUTER JOIN
EQUI JOIN
SELF JOIN
CROSS JOIN
ANTI JOIN
SEMI JOIN
ORACLE ADVANCE
PROCEDURES
FUNCTION
CURSOR
TRIGGER

INSERT ALL



Oracle - Insert All


The Oracle INSERT ALL statement is used to insert multiple rows with a single INSERT statement. You can insert the rows into one table or multiple tables by using only one SQL command.


SYNTAX :

INSERT ALL  
  INTO table_name (column1, column2, column_n) VALUES (expr1, expr2, expr_n)  
  INTO table_name(column1, column2, column_n) VALUES (expr1, expr2, expr_n)  
  INTO table_name (column1, column2, column_n) VALUES (expr1, expr2, expr_n)  
SELECT * FROM dual;  

Parameters :


  • table_name : it specifies the table in which you want to insert your records.

  • column1, column2, column_n : this specifies the columns in the table to insert values.

  • expr1, expr2, expr_n : this specifies the values to assign to the columns in the table.


    Oracle INSERT ALL Example


    This example specifies how to insert multiple records in one table. Here we insert three rows into the "suppliers" table.

    INSERT ALL  
      INTO suppliers (supplier_id, supplier_name) VALUES (20, 'Google')  
      INTO suppliers (supplier_id, supplier_name) VALUES (21, 'Microsoft')  
      INTO suppliers (supplier_id, supplier_name) VALUES (22, 'Apple')  
    SELECT * FROM dual;  
    

    Output :

    3 row(s) inserted. 0.02 seconds


    This is totally equivalent to the following three INSERT statements.

    INSERT INTO suppliers (supplier_id, supplier_name) VALUES (1000, 'Google');  
    INSERT INTO suppliers (supplier_id, supplier_name) VALUES (2000, 'Microsoft');  
    INSERT INTO suppliers (supplier_id, supplier_name) VALUES (3000, 'Apple');  
    

    Oracle INSERT ALL Example: (Insert into multiple tables)


    The INSERT ALL statement can also be used to insert multiple rows into more than one table by one command only.

    In the following example, we are going to insert records into the both "suppliers" and "customers" tables.

    INSERT ALL  
      INTO suppliers (supplier_id, supplier_name) VALUES (30, 'Google')  
      INTO suppliers (supplier_id, supplier_name) VALUES (31, 'Microsoft')  
      INTO customers (age, name, address) VALUES (29, 'Luca Warsi', 'New York')  
    SELECT * FROM dual;  
    

    Output :
    3 row(s) inserted.
    0.03 seconds
    

    Here, total 3 rows are inserted, 2 rows are inserted into the suppliers table and one row into the customers table.



    What Is Oracle

    What Is Oracle

    posted on 2019-11-29 01:11:21 - ORACLE Tutorials


    TRIGGER

    ORACLE - Trigger

    posted on 2019-11-28 22:14:22 - ORACLE Tutorials


    CURSOR

    ORACLE - Cursor

    posted on 2019-11-28 22:13:54 - ORACLE Tutorials


    MySQL TRIGGERS

    MySQL - Triggers

    posted on 2019-11-29 21:44:07 - mysql Tutorials


    Grant_ Revoke Privilege

    MySQL - Grant_ Revoke Privilege

    posted on 2019-11-26 23:15:04 - mysql Tutorials


    MySQL Vs SQL

    MySQL Vs SQL

    posted on 2019-11-25 05:02:26 - mysql Tutorials