我有一个程序我需要设置d_x FOR select语句1,d_y FOR select语句2,d_z用于select语句3.我怎样才能修改下面的程序来实现...
CREATE PROCEDURE A ()
BEGIN
DECLARE d_a INT;
DECLARE d_b INT;
DECLARE d_c INT;
---
--
-
DECLARE CONTINUE HANDLER FOR NOT FOUND
BEGIN
SET d_x = 1;
SET d_y = 2;
SET d_z = 3;
END;
SELECT aa INTO d_x FROM TEST1;
SELECT bb INTO d_y FROM TEST2;
SELECT cc INTO d_z FROM TEST3;
END
答案 0 :(得分:0)
我为我的问题找到了一个解决方案。可能的答案。但如果有更多的替代方式请定义。
CREATE PROCEDURE A ()
BEGIN
DECLARE d_a INT;
DECLARE d_b INT;
DECLARE d_c INT;
---
--
-
BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND
BEGIN
SET d_x = 1;
END;
SELECT aa INTO d_x FROM TEST1;
END;
BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND
BEGIN
SET d_y = 2;
END;
SELECT bb INTO d_y FROM TEST2;
END;
BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND
BEGIN
SET d_y = 2;
END;
SELECT cc INTO d_z FROM TEST3;
END;
END