:
DELIMITER $$
DROP PROCEDURE IF EXISTS `test`.`handlerdemo`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `handlerdemo`()
BEGIN
DECLARE X2 INT;
DECLARE CONTINUE HANDLER FÜR SQLWARNING SET X2= 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET X2 = 2;
DECLARE CONTINUE HANDLER FÜR SQLSTATE '23000' SET X2= 3;
DECLARE CONTINUE HANDLER FÜR SQLEXCEPTION SET X2 = 4;
TRANSAKTION STARTEN;
SAVEPOINT savepoint_1;
BEGIN
INSERT INTO eugene VALUES (1);
EINFÜGEN IN eugene VALUES (2);
WÄHLEN Sie X2;
Ende;
ROLLBACK ZUM SAVEPOINT savepoint_1;
EINFÜGEN IN eugene VALUES (3);
END$$
DELIMITER ;
#测试表
CREATE TABLE `eugene` (
t1` int(4) default NULL
)