Host variables can be structures. When the precompiler runs, it splits the structure into its individual components, in the order of the component declarations.
When you use structures as host variables, you can, for example, specify multiple values in the INTO clause of a SELECT statement at the same time.
EXEC SQL BEGIN DECLARE SECTION;
typedef char string8 [8];
struct {
char addr [6];
struct {
string8
lname, fname [3];
} name;
} person;
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT !person INTO :person
FROM customer WHERE cno = 100;
You can use a simplified notation for structures in SQL statements.
You can also specify the corresponding indicator variable as a structure with the same number of components.
You can generate the structure definition from a database table or a database procedure.