Details
-
Task
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
Description
The only option for a prepared statement is currently to EXECUTE it. This feature is a request to be able to OPEN a stored procedure as a cursor and FETCH from it.
delimiter //
|
CREATE OR REPLACE PROCEDURE proc1(p1 INTEGER) |
BEGIN
|
DECLARE done INT DEFAULT FALSE; |
DECLARE v1 INTEGER; |
DECLARE c1 CURSOR; |
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; |
 |
PREPARE s1 FROM 'SELECT c1 FROM t1 WHERE c1 < ?'; |
OPEN c1 FROM s1 USING p1; |
read_loop: LOOP
|
FETCH c1 INTO v1; |
IF done THEN |
LEAVE read_loop;
|
END IF; |
CALL proc1(v1);
|
END LOOP; |
CLOSE c1; |
END; |
//
|