Using a System-Descriptor Area (X/Open)
You can use a system-descriptor area to store output values when you do not know the number of return values or their data types that a SELECT or EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement returns at runtime. A system-descriptor area describes the data type and memory location of one or more return values, and conforms to the X/Open standards.
The keywords USING SQL DESCRIPTOR introduce the name of the system-descriptor area into which you fetch the contents of a row or the return values of a user-defined function. You can then use the GET DESCRIPTOR statement to transfer the values that the FETCH statement returns from the system-descriptor area into host variables.
EXEC SQL allocate descriptor 'desc'; ... EXEC SQL declare selcurs cursor for select * from customer where state = 'CA'; EXEC SQL describe selcurs using sql descriptor 'desc'; EXEC SQL open selcurs; while (1) { EXEC SQL fetch selcurs using sql descriptor 'desc';
You can also use an sqlda structure to supply parameters dynamically.