SET data type example
The SET data type is an unordered collection type that stores unique elements. The number of elements in a SET data type can vary, but no nulls are allowed.
The following statement creates a table in which the children column
is defined as a SET:
CREATE TABLE employee
(
name char(30),
address char(40),
children SET (varchar(30) NOT NULL)
);
The data from the employee table is unloaded into the employee.unl file. Each data
row contains four delimited fields. The first set contains three elements (Karen,
Lauren, and Andrea), whereas the second set contains four elements. The
SET constructor precedes each SET data row.
Muriel|5555 SW Merry Sailing Dr.|02/06/1926|SET{'Karen','Lauren','Andrea'}|
Larry|1234 Indian Lane|07/31/1927|SET{'Martha', 'Melissa','Craig','Larry'}|
This dbload example shows how to insert data that contains
SET data types into the employee table in the new database.
Put double quotes around each SET data type or the insert does not
work.
FILE employee.unl DELIMITER '|' 4;
INSERT INTO employee
VALUES ('Marvin', '10734 Pardee', '06/17/27',
"SET{'Joe', 'Ann'}");