This Oracle tutorial explains how to use the Oracle INSERT ALL statement with syntax and examples.
The Oracle INSERT ALL statement is used to add multiple rows with a single INSERT statement. The rows can be inserted into one table or multiple tables using only one SQL command.
The syntax for the INSERT ALL statement in Oracle/PLSQL is:
The table to insert the records into.
The columns in the table to insert values.
The values to assign to the columns in the table.
You can use the INSERT INTO statement to insert multiple records into one table.
For example, if you wanted to insert 3 rows into the suppliers table, you could run the following SQL statement:
This is equivalent to the following 3 INSERT statements:
You can also use the INSERT ALL statement to insert multiple rows into more than one table in one command.
For example, if you wanted to insert into both the suppliers and customers table, you could run the following SQL statement:
This example will insert 2 rows into the suppliers table and 1 row into the customers table. It is equivalent to running these 3 INSERT statements: