The PL feature of OceanBase AI Database has limitations when handling exceptions.
The following limitations apply to the PL feature of OceanBase AI Database when performing exception handling:
SIGNAL,RESIGNAL, andGET DIAGNOSTICSare not allowed as prepared statements. Statements in the following examples are invalid:PREPARE stmt1 FROM 'SIGNAL SQLSTATE "42000"';SQLSTATE values of the '04' category are not specially handled and are therefore processed in the same way as other exceptions.
In standard SQL, the first condition should be related to the
SQLSTATEvalue returned by the previous SQL statement. However, this is not always the case, so you cannot obtain the main error message using the following statement:GET DIAGNOSTICS CONDITION 1 @err_no = MYSQL_ERRNO;Instead, it is recommended to use the following approach:
GET DIAGNOSTICS @count_no = NUMBER; GET DIAGNOSTICS CONDITION @count_no @err_no = MYSQL_ERRNO;