SQLSTATE

The SQLSTATE variable returns the code corresponding to the last SQL error.

Syntax

SQLSTATE

Usage

The SQLSTATE predefined variable returns the ANSI/ISO SQLSTATE code when an SQL error occurred.

The SQLSTATE error code is a standard ANSI specification, but not all database engines support this feature. Check the database server documentation for more details.

The variable is NULL if the last SQL statement was successfull.

Example

MAIN
  DATABASE stores 
  WHENEVER ERROR CONTINUE
  SELECT foo FROM bar 
  DISPLAY SQLSTATE
END MAIN