MULTISET
MULTISET is a SQL operation that allows the creation of a derived table from subqueries, where each row in the derived table is a collection of rows containing similar types from the subquery. It permits duplicate values and permits querying of individual elements.
Example
Output
No specific output is displayed as it is a PL/SQL anonymous block.
Explanation
In this example, two user-defined types are declared: a record type phone_type
and a table type phone_table_type
. In the BEGIN
section, two records are inserted into a table phone_table
. The phone_table_type
tyep enables creation of a table-like structure in PL/SQL block.
Example
Output
Explanation
In the above example, a numeric field PatientID
, a string field Name
, and a MULTISET
field Allergies
are defined in the Patients
table. The MULTISET
field is used to store multiple values in a single field. A single row is inserted into the Patients
table. The MULTISET
field Allergies
in the inserted row contains the values 'Penicillin, Latex'
.