Download Informix CLI Programmer`s Manual, Version 2.5

Transcript
A
SELECT statement is used to retrieve data that meets a given set
of specifications. In the following example, a SELECT statement retrieves all
columns for employees named Jones from all the rows in the EMPLOYEE
table.
SELECT * FROM EMPLOYEE WHERE EMPNAME = "Jones"
INFORMIX-CLI functions can also retrieve data. For example, SQLColumns
retrieves data about columns in the data source. These sets of data, called
result sets, can contain zero or more rows.
Other SQL statements, such as GRANT or REVOKE, do not return result sets.
For these statements, the return code from SQLExecute or SQLExecDirect is
usually the only source of information about whether the statement is
successful. For INSERT, UPDATE, and DELETE statements, an application can
call SQLRowCount to return the number of affected rows.
The steps an application takes to process a result set depends on what is
known about it. The following list defines known and unknown result sets:
Known result set
The application knows the exact form of the SQL
statement, and therefore the result set, when the
statement compiles. For example, the query SELECT
EMPNO, EMPNAME FROM EMPLOYEE returns two
specific columns.
Unknown result set
The application does not know the exact form of the
SQL statement, and therefore the result set, when the
statement compiles. For example, the ad hoc query
SELECT * FROM EMPLOYEE returns all the currently
defined columns in the EMPLOYEE table. The application might not predict the format of these results
before it executes the command.
Retrieving Results
7-3