Can some one tell me why the following stored procedure is giving me an error -
CREATE PROCEDURE test(emailA varchar(50))
BEGIN
DECLARE a INT;
DECLARE f_id BIGINT;
DECLARE exit handler for sqlexception sqlwarning
BEGIN
SET a = 1;
END;
DECLARE EXIT HANDLER FOR 1072
BEGIN
CALL log_error(1072,'test');
END;
SELECT id INTO f_id FROM user WHERE email = emailA;
END//
ERROR
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 'sqlwarning BEGIN SET a = 1; END; DECLARE EXIT HANDLER F' at line 6
I think you need to add comma
DECLARE exit HANDLER FOR SQLEXCEPTION, SQLWARNING
if not solved yet..
Hope this works
DECLARE exit handler for sqlexception SET a = 1, sqlwarning CALL log_error(1072,'test');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.