Valid in: ESQL
The Inquire_sql statement provides an application program with a variety of run-time information.
Note: Inquire_sql is a synonym for inquire_ingres.
The Inquire_sql statement has the following format:
EXEC SQL INQUIRE_SQL (variable = object {, variable = object});
The Inquire_sql statement enables an embedded SQL program to retrieve a variety of runtime information, such as:
The inquire_sql statement does not execute queries; the information inquire_sql returns to the program reflects the results of the last query that was executed. For this reason, the inquire_sql statement must be issued after the database statement about which information is desired, and before another database statement is executed (and resets the values returned by inquire_sql). variable is the name of a program variable.
To retrieve error or message information about database procedure statements, issue the inquire_sql statement inside an error or message handler called by the whenever sqlerror or whenever sqlmessage statement.
Some of the information returned by inquire_sql is also available in the SQLCA. For example, the error number returned by the object errorno is also available in the SQLCA sqlcode field. Similarly, when an error occurs, the error text can be retrieved using inquire_sql with the errortext object or it can be retrieved from the SQLCA sqlerrm variable. Errortext provides the complete text of the error message, which is often truncated in sqlerrm.
This statement must be terminated according to the rules of your host language.