MULTISET
Example
Section titled “Example”DECLARE TYPE phone_type IS RECORD ( country_code NUMBER(3), area_code NUMBER(3), phone_number VARCHAR2(8) ); TYPE phone_table_type IS TABLE OF phone_type; phone_table phone_table_type;BEGIN phone_table := phone_table_type( phone_type(1, 408, '1234567'), phone_type(1, 650, '7654321') );END;Output
Section titled “Output”No specific output is displayed as it is a PL/SQL anonymous block.
Explanation
Section titled “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
Section titled “Example”CREATE TABLE Patients ( PatientID int, Name varchar(255), Allergies nvarchar(max),);
INSERT INTO Patients (PatientID, Name, Allergies)VALUES (1, 'John Doe', 'Penicillin, Latex');Output
Section titled “Output”(1 row(s) affected)Explanation
Section titled “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'.