Description
The INQUIRE_SQL statement enables an embedded OpenSQL program to retrieve a variety of runtime information, such as:
• Information about the last executed database statement
• Status information, such as the current session ID, the type of error (local or generic) being returned to the application, and whether a transaction is currently open
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).
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.