The untyped collection variable
An untyped collection variable provides a general description of a collection. This declaration includes only the collection keyword and the variable name.
EXEC SQL BEGIN DECLARE SECTION;
client collection collection1, collection2;
client collection grades;
EXEC SQL END DECLARE SECTION;
To obtain the description of a collection column, execute a SELECT statement to retrieve the column into the untyped collection variable. The database server returns the column description (the collection type and the element type) with the column data. IBM® Informix® ESQL/C assigns this definition of the collection column to the untyped collection variable.
EXEC SQL BEGIN DECLARE SECTION;
client collection a_coll;
EXEC SQL END DECLARE SECTION;
EXEC SQL allocate collection :a_coll;
/* select LIST column into the untyped collection variable
* to obtain the data-type information */
EXEC SQL select list_col into :a_coll from tab_list;
/* Insert an element at the end of the LIST in the untyped
* collection variable */
EXEC SQL insert into table(:a_coll) values (7);
To obtain the description of a collection column, your application must verify that a collection column has data in it before it selects the column. If the table has no rows in it, the SELECT statement does not returns column data or the column description and Informix ESQL/C cannot assign the column description to the untyped collection variable.