不允许将SIGNAL
, RESIGNAL
, and GET DIAGNOSTICS
are not permissible as prepared statements. SIGNAL
、RESIGNAL
和GET DIAGNOSTICS
作为准备好的声明。For example, this statement is invalid:例如,此语句无效:
PREPARE stmt1 FROM 'SIGNAL SQLSTATE "02000"';
类SQLSTATE
values in class '04'
are not treated specially. '04'
中的SQLSTATE
值没有经过特殊处理。They are handled the same as other exceptions.它们的处理方式与其他异常相同。
In standard SQL, the first condition relates to the 在标准SQL中,第一个条件与前一条SQL语句返回的SQLSTATE
value returned for the previous SQL statement. SQLSTATE
值有关。In MySQL, this is not guaranteed, so to get the main error, you cannot do this:在MySQL中,这是不能保证的,所以要获取主要错误,您不能这样做:
GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
Instead, do this:相反,要这样做:
GET DIAGNOSTICS @cno = NUMBER; GET DIAGNOSTICS CONDITION @cno @errno = MYSQL_ERRNO;