Home » Oracle Insert All

Oracle Insert All

by Online Tutorials Library

Oracle INSERT ALL statement

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

Parameters

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

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

3) 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.

Output

3 row(s) inserted. 0.02 seconds 

This is totally equivalent to the following three INSERT statements.

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.

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.

You may also like