-- 方法一:使用sqlstate_value
DECLARE command_not_allowed CONDITION FOR SQLSTATE '42000' ;Query: -- 方法一:使用sqlstate_value declare command_not_allowed condition for sqlstate '42000' Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare command_not_allowed condition for sqlstate '42000'' at line 2Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.003 sec
---------------------------------------------------
DROP PROCEDURE IF EXISTS Proc;DELIMITER //
CREATE PROCEDURE Proc()
BEGIN
DECLARE command_not_allowed CONDITION FOR SQLSTATE '42000' ;
END//
DELIMITER ;CALL Proc();