Allowing multiple data values to be stored in a single attribute is an extended feature of relational database. Elements of a collection are possible to have different domain each other. The domain can be one of the primitive data types or classes excluding virtual classes. For example, SET (INTEGER, tbl_1) can specify an integer or a set of row values of the user-defined class tbl_1 as a domain. When a domain list is not specified (e.g. SET ( )), all data types are allowed as elements including user-defined classes.
The data of a collection-type column with at least two domain lists can be retrieved by using the csql utility or the C-API. It cannot be retrieved in CUBRID manager or CUBRID API (JDBC, ODBC, OLEDB, PHP, CCI).
Collection Types Supported by CUBRID
Type |
Description |
Definition |
Input Data |
Stored Data |
---|---|---|---|---|
SET |
A union which does not allow duplicates |
col_name SET VARCHAR(20 |
{'c','c','c','b','b', 'a'} |
{'a','b','c'} |
MULTISET |
A union which allows duplicates |
col_name MULTISET VARCHAR(20) |
{'c','c','c','b','b', 'a'} |
{'a','b','b','c','c','c'} |
LIST SEQUENCE |
A union which allows duplicates and stores data in the order of input |
col_name LIST VARCHAR(20) |
{'c','c','c','b','b', 'a'} |
{'c','c','c','b','b','a'} |
As you see the table above, the value specified as a collection type can be inputted with braces ('{', '}') each value is separated with a comma (,).
Coercions
If the specified domains are identical, the collection types can be cast explicitly by using the CAST operator. The following table shows the collection types that allow explicit coercions.
Explicit Coercions
|
TO |
|||
---|---|---|---|---|
FROM |
|
SET |
MULTISET |
LIST |
SET |
- |
O |
O |
|
MULTISET |
O |
- |
X |
|
LIST |
O |
O |
- |