DELIMITER //
DROP PROCEDURE IF EXISTS test//
CREATE PROCEDURE test()
BEGIN
DECLARE results,id2,c INT DEFAULT 0;
DECLARE cur_1 CURSOR FOR SELECT id FROM t1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET results = NULL;
OPEN cur_1;
FETCH cur_1 INTO id2;
WHILE(results IS NOT NULL) DO
#假如这里查询不到记录,则while循环也退出了,有没有什么办法使while循环不会因为这个而退出呢?
SELECT x INTO c FROM t2;
#do some thing...
FETCH cur_1 INTO id2;
END WHILE;
CLOSE cur_1;
END //
DELIMITER ;
------解决方案--------------------
无人。。。。。。。