Using the BULK COLLECT Clause v12
SQL commands that return a result set consisting of a large number of rows may not be operating as efficiently as possible due to the constant context switching that must occur between the database server and the client in order to transfer the entire result set. This inefficiency can be mitigated by using a collection to gather the entire result set in memory which the client can then access. The BULK COLLECT
clause is used to specify the aggregation of the result set into a collection.
The BULK COLLECT
clause can be used with the SELECT INTO, FETCH INTO
and EXECUTE IMMEDIATE
commands, and with the RETURNING INTO
clause of the DELETE, INSERT
, and UPDATE
commands. Each of these is illustrated in the following sections.
select_bulk_collect fetch_bulk_collect execute_immediate_bulk_collect returning_bulk_collect