MySQL Forums
Forum List  »  InnoDB

Dynamic cursor
Posted by: Jean Valjean
Date: March 17, 2009 10:13AM

Hello everybody,

I wondered if MySQL 5.1 handle the dynamic cursor. In fact, many forum tell me it doesn't handle it. Nervertheless, i found an explication that tells me to check an option on ODBC which permits to allows use of dynamic cursor.

For example :

DELIMITER $$
DROP PROCEDURE IF EXISTS dyn $$
CREATE PROCEDURE dyn()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a INT;
set @query = 'select * from g';
DECLARE cur1 CURSOR FOR query;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur1;
Fetch cur1 into a;
REPEAT
INSERT INTO t1 values(a);
UNTIL done END REPEAT;
CLOSE cur1;
END $$
DELIMITER ;

This type of code doesn't work. Maybe, i did some mistake but please help me.

Options: ReplyQuote


Subject
Views
Written By
Posted
Dynamic cursor
6024
March 17, 2009 10:13AM
2872
March 17, 2009 10:56AM
2934
March 18, 2009 01:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.