OceanBase Database has certain limitations on the PL exception handling feature.
Take note of the following limitations when you use PL exception handling statements in OceanBase Database:
SIGNAL,RESIGNAL, andGET DIAGNOSTICScannot be used as prepared statements. Statements similar to the following example are invalid:PREPARE stmt1 FROM 'SIGNAL SQLSTATE "42000"';SQLSTATEvalues of the ‘04’ class are not specially treated, and therefore are handled in the same way as other exceptions.In standard SQL syntax, the first condition must be related with the
SQLSTATEvalue returned by the previous SQL statement, which is not always the case. Therefore, you cannot obtain the main error message by using the following statement:GET DIAGNOSTICS CONDITION 1 @err_no = MYSQL_ERRNO;We recommend that you use the following method instead:
GET DIAGNOSTICS @count_no = NUMBER; GET DIAGNOSTICS CONDITION @count_no @err_no = MYSQL_ERRNO;