DECLAREcondition_nameCONDITION FORcondition_valuecondition_value: SQLSTATE [VALUE]sqlstate_value|mysql_error_code
This statement specifies conditions that need specific
handling. It associates a name with a specified error
condition. The name can subsequently be used in a
DECLARE HANDLER statement. See
Section 18.2.8.2, “DECLARE Handlers”.
A condition_value can be an
SQLSTATE value or a MySQL error code.

User Comments
CREATE PROCEDURE sp_condition(IN var1 INT)
BEGIN
IF (var1 > 10)
THEN SELECT 'greater';
ELSE SELECT 'less than or equal';
END IF;
END
Add your own comment.