Result Sets
A statement that is executed can have no, one, or multiple result sets. As discussed in Introduction to SQL, SQL is a set-oriented language.
The Update, Insert, and Delete statements have no result set. A single select statement has one result set. A batch is a group of two or more SQL statements or a single SQL statement that has the same effect (calling a procedure, for example).
Result sets can be traversed in a forward direction only, one row at a time. This is done by “fetching” the current row. After the row has been fetched, the data of that row can be retrieved. The Embedded SQL interface offers several different ways to retrieve the data. It can be retrieved into variables or file buffers. For larger data types, such as BLOBs, CLOBs, and the like, an interface has been defined that allows retrieval of the data in smaller-sized chunks.
For fetching rows, the Embedded SQL interface defines SQLFetch. For getting data, SQLBindFile, SQLColumnValue, and SQLGetData have been defined. To switch to the next result set in a batch, SQLNextResultSet has been defined.
A result set is made up of one or more columns. The number of columns and some attributes per column can be retrieved by using SQLStmtAttribute and SQLColAttribute.