Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

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

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

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

INSERT INTO set_tbl VALUES ({NULL});

INSERT INTO set_tbl VALUES ({''});

SELECT * FROM set_tbl;

  col_1

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

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

{NULL}

{' '}

 

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

   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}

  {' '}  {' '}

 

INSERT INTO set_tbl VALUES ('');

 

ERROR: Cannot coerce '' to type set.