-- DECLARE CONDITION DECLARE condition_name CONDITION FOR condition_value condition_value: SQLSTATE [VALUE] sqlstate_value | mysql_error_code -- DECLARE HANDLER DECLARE handler_type HANDLER FOR condition_value [, condition_value] ... statement handler_type: CONTINUE | EXIT | UNDO condition_value: SQLSTATE [VALUE] sqlstate_value | condition_name | SQLWARNING | NOT FOUND | SQLEXCEPTION | mariadb_error_code -- Example DELIMITER // CREATE PROCEDURE handlerdemo ( ) BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1; SET @x = 1; INSERT INTO test.t VALUES (1); SET @x = 2; INSERT INTO test.t VALUES (1); SET @x = 3; END; // DELIMITER ; -- DECLARE VARIABLE DECLARE tmp TYPE OF t1.a; DECLARE rec1 ROW TYPE OF t1; DECLARE rec2 ROW TYPE OF cur1;
SQL Справочник v0.05 © 2007-2025 Igor Salnikov aka SunDoctor