5. Working with a Database : Handling Database Errors : How You Can Use the Inquire_sql Statement
 
Share this page                  
How You Can Use the Inquire_sql Statement
The inquire_sql statement returns runtime diagnostic and status information about database statements in an application. In OpenROAD, this statement can be most useful for retrieving error text or determining the transaction state. The syntax of this statement is:
inquire_sql (:variable_name = constant
          {, :variable_name = constant})
To retrieve error text, specify the errortext constant; to determine the transaction state, use the transaction constant. Errortext returns a varchar string and transaction returns an integer (TRUE or FALSE).
For example, your error handling procedure might use inquire_sql to determine if a transaction is open:
procedure error_handler(
...
) =
begin
    ...
    inquire_sql (in_xact = transaction);
    if in_xact = FALSE then
    ...
end;