The BULK COLLECT clause can be added to the RETURNING INTO clause of a DELETE, INSERT, or UPDATE command. (See Using the RETURNING INTO Clause for information on the RETURNING INTO clause.)
insert, update, and delete are the INSERT, UPDATE, and DELETE commands as described in INSERT, UPDATE, and DELETE, respectively. If a single collection is specified, then collection may be a collection of a single field, or it may be a collection of a record type. If more than one collection is specified, then each collection must consist of a single field. The expressions following the RETURNING keyword must match in number, order, and type-compatibility all fields in the target collections. If * is specified, then all columns in the affected table are returned. (Note that the use of * is an Advanced Server extension and is not compatible with Oracle databases.)
The clerkemp table created by copying the emp table is used in the remaining examples in this section as shown below.
The following example increases everyone’s salary by 1.5, stores the employees’ numbers, names, and new salaries in three associative arrays, and finally, displays the contents of these arrays.
The following example performs the same functionality as the previous example, but uses a single collection defined with a record type to store the employees’ numbers, names, and new salaries.
The following example deletes all rows from the clerkemp table, and returns information on the deleted rows into an associative array, which is then displayed.