SQLERRMESSAGE
The SQLERRMESSAGE variable
holds the error message corresponding to the last SQL error.
Syntax
SQLERRMESSAGE 
Usage
The SQLERRMESSAGE predefined variable returns the error message if an
SQL error occurred.
The variable is NULL if the last SQL statement was successful.
Example
MAIN
  DATABASE stores 
  WHENEVER ERROR CONTINUE
  SELECT foo FROM bar 
  DISPLAY SQLERRMESSAGE
END MAIN