Using the RETURNED_SQLSTATE Keyword

The RETURNED_SQLSTATE keyword returns the SQLSTATE value that describes the exception.