Using the SQLSTATE Error Status Code
When an SQL statement executes, an error status code is automatically generated. This code represents success, failure, warning, or no data found. This error status code is stored in a built-in variable called SQLSTATE.