Handling an unknown select list
For a SELECT statement, the columns in the select list identify the column values that are received from the database server. In the SELECT statement described and illustrated in the demo1.ec example program (see A sample HCL OneDB ESQL/C program), the values returned from the query are placed into the host variables that are listed in an INTO host_var clause of the SELECT statement.
- Declare a dynamic-management structure to serve as storage for
the select-list column definitions. This structure can be either a
system-descriptor area or an sqlda structure.
Use of the system-descriptor area conforms to X/Open standards.
- Use the DESCRIBE statement to examine the select list of the prepared SELECT statement and describes the columns.
- Specify the dynamic-management structure as the location of the data fetched from the database. From the dynamic-management structure, the program can move the column values into host variables.
For information about how to execute a SELECT if you do know the number and data types of select-list columns, see Execute SELECT statements. For information about how to identify columns in the select list of a SELECT statement with a system-descriptor area, see Handling an unknown select list. For more information about how to use an sqlda structure, see Handling an unknown select list.