EXEC SQL BEGIN DECLARE SECTION; client collection multiset(integer not null) a_multiset; EXEC SQL END DECLARE SECTION;
EXEC SQL allocate collection :a_multiset; EXEC SQL select multiset_col into :a_multiset from table1 where id = 107; EXEC SQL insert into table(:a_multiset) values (142323); EXEC SQL update table1 set multiset_col = :a_multiset where id = 107; EXEC SQL deallocate collection :a_multiset;
当要把元素插入到 client-collection 变量中时,不能在 INSERT 语句的 VALUES 子句中指定 SELECT 语句或 EXECUTE FUNCTION 语句。然而,当要把元素插入到 server-collection 变量中时,SELECT 和 EXECUTE FUNCTION 语句在 VALUES 子句中是有效的。有关 client- 和 server-collection 变量的更多信息,请参阅 GBase 8s ESQL/C 程序员手册。