Declaring structured type host variables

To retrieve or send structured type host variables in static SQL, you must provide an SQL declaration that indicates the built-in type used to represent the structured type.

About this task

The format of the declaration is as follows:

   EXEC SQL BEGIN DECLARE SECTION ;

      SQL TYPE IS structured_type AS base_type host-variable-name ;

   EXEC SQL END DECLARE SECTION;

For example, assume that the type Address_t is to be transformed to a varying-length character type when passed to the client application. Use the following declaration for the Address_t type host variable:

   SQL TYPE IS Address_t AS VARCHAR(150) addrhv;