Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 | 

SET

Description

SET is a set type in which each element has different values. Elements of a SET can have many different data types or even instances of different classes.

Example

csql> CREATE TABLE set_tbl ( col_1 set(int, CHAR(1)));

csql> INSERT INTO set_tbl VALUES ({3,3,3,2,2,1,0,'c','c','c','b','b','a'});

csql> INSERT INTO set_tbl VALUES ({NULL});

csql> INSERT INTO set_tbl VALUES ({''});

csql> SELECT * FROM set_tbl;

csql> ;xr

 

=== <Result of SELECT Command in Line 1> ===

  col_1

======================

{0, 1, 2, 3, 'a', 'b', 'c'}

{NULL}

{' '}

 

csql> SELECT CAST(col_1 AS MULTISET), CAST(col_1 AS LIST) FROM set_tbl;

csql> ;xr

 

=== <Result of SELECT Command in Line 1> ===

 

   cast(col_1 as multiset)   cast(col_1 as sequence)

============================================

  {0, 1, 2, 3, 'a', 'b', 'c'}  {0, 1, 2, 3, 'a', 'b', 'c'}

  {NULL}  {NULL}

  {' '}  {' '}

 

csql> INSERT INTO set_tbl VALUES ('');

ERROR: Cannot coerce '' to type set.

ERROR: Incompatible data type on attribute col_1.