Named row types

A named row type associates a name with the row structure. For a database, you create a named row type with the CREATE ROW TYPE statement.

If the database contains more than one row type with the same structure but with distinctly different names, the database server cannot properly enforce structural equivalence when it compares named row types. To resolve this ambiguity, specify a row-type name in the declaration of the row variable.

A named Informix® ESQL/C row variable can be typed or untyped.

The Informix® ESQL/C preprocessor does not check the validity of a row-type name and Informix® ESQL/C does not use this name at run time. Informix® ESQL/C just sends this name to the database server to provide information for type resolution. Therefore, Informix® ESQL/C treats the a_row variable in the following declaration as an untyped row variable even though a row-type name is specified:
EXEC SQL BEGIN DECLARE SECTION;
   row 'address_t' a_row;
EXEC SQL END DECLARE SECTION;
If you specify both the row-type name and a row structure in the declaration (a typed named row variable), the row-type name overrides the structure. For example, suppose the database contains the following definition of the address_t named row type:
CREATE ROW TYPE address_t 
(
   line1       char(20),
   line2       char(20),
   city        char(20),
   state       char(2),
   zipcode     integer
);
In the following declaration, the another_row host variable has line1 and line2 fields of type CHAR(20) (from the address_t row type:), not CHAR(10) as the declaration specifies
EXEC SQL BEGIN DECLARE SECTION;
   row 'address_t' (line1 char(10), line2 char(10), 
      city char(20), state char(2), zipcode integer) another_row;
EXEC SQL END DECLARE SECTION;