Insert elements into SET and MULTISET collections
For SET and MULTISET collections, the position of the
new element is undefined, because the elements of these collections
do not have ordered positions. Suppose the table readings has
the following declaration:
CREATE TABLE readings
(
dataset_id INT8,
time_dataset MULTISET(INT8 NOT NULL)
);
To access the time_dataset column, the
typed host
variable time_vals has the following declaration:
EXEC SQL BEGIN DECLARE SECTION;
client collection multiset(int8 not null) time_vals;
ifx_int8_t an_int8;
EXEC SQL END DECLARE SECTION;
The following INSERT statement adds a new MULTISET element
of
1,423,231
to time_vals: EXEC SQL allocate collection :time_vals;
EXEC SQL select time_dataset into :time_vals
from readings
where dataset_id = 1356;
ifx_int8cvint(1423231, &an_int8);
EXEC SQL insert into table(:time_vals) values (:an_int8);
For more information about the ifx_int8cvint() function and the INT8 data type, see Numeric data types.