Examples of Collection Constructors
The following example shows that you can construct a collection
with various expressions, if the resulting values are of the same
data type:
CREATE FUNCTION f (a int) RETURNS int;
RETURN a+1;
END FUNCTION;
CREATE TABLE tab1 (x SET(INT NOT NULL));
INSERT INTO tab1 VALUES
(
SET{10,
1+2+3,
f(10)-f(2),
SQRT(100) +POW(2,3),
(SELECT tabid FROM systables WHERE tabname = 'sysusers'),
'T'::BOOLEAN::INT}
);
SELECT * FROM tab1 WHERE
x=SET{10,
1+2+3,
f(10)-f(2),
SQRT(100) +POW(2,3),
(SELECT tabid FROM systables WHERE tabname = 'sysusers'),
'T'::BOOLEAN::INT}
};
This assumes that a cast from BOOLEAN to INT exists. (For a more restrictive syntax to specify collection values , see Literal Collection.)