Collection subqueries

A collection subquery enables users to construct a collection expression from a subquery expression. A collection subquery uses the MULTISET keyword immediately before the subquery to convert the values returned into a MULTISET collection. When you use the MULTISET keyword before a subquery expression, however, the database server does not change the rows of the underlying table but only modifies a copy of those rows. For example, if a collection subquery is passed to a user-defined routine that modifies the collection, then a copy of the collection is modified but not the underlying table.

A collection subquery is an expression that can take either of the following forms:
  • MULTISET(SELECT expression1, expression2... FROM tab_name...)
  • MULTISET(SELECT ITEM expression FROM tab_name...)