限制SIGNAL, RESIGNAL, GET DIAGNOSTICS 不允许作为预备语句。例如,该语句无效SIGNAL,
RESIGNAL, and
GET DIAGNOSTICS are not permissible
as prepared statements. For example, this statement is invalid:
PREPARE stmt1 FROM 'SIGNAL SQLSTATE "02000"';
:SQLSTATE在类'04'中不被特别处理。它们的处理方式与其他例外相同。SQLSTATE values in class
'04' are not treated specially. They are
handled the same as other exceptions.
在标准 SQL 中,第一个条件与前一个 SQL 语句返回的SQLSTATE。在 MySQL 中,这种情况并不保证,所以要出现主要错误,你不能这样做:In standard SQL, the first condition relates to the
SQLSTATE value returned for the previous SQL
statement. In MySQL, this is not guaranteed, so to get the main
error, you cannot do this:
GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
相反,这样做Instead, do this:
GET DIAGNOSTICS @cno = NUMBER; GET DIAGNOSTICS CONDITION @cno @errno = MYSQL_ERRNO;