MySQL Forums
Forum List  »  InnoDB

no data to fetch from a cursor
Posted by: Sally Masipa
Date: February 06, 2009 02:20AM

hi can someone tell me what am I doingwrong here to get this error --> No data to FETCH
====================
DELIMITER $$

DROP PROCEDURE IF EXISTS `test`.`test1` $$
CREATE PROCEDURE `test1`(Eme varchar(10))
BEGIN



Declare ls date;
Declare le date;
Declare Em varchar(7);


Declare CUR_ cursor FOR select Ema,le,ls
From B where Ema = Eme;

create temporary table test(Dayname date);


open CUR_;
Fetch CUR_ into Em,le,ls;

while ls <= le do


insert into test (Dayname) select dayname(ls);

set ls = date_add(ls, interval 1 day);

fetch next from CUR_ into Em,le,ls;

Select dayname from test;

End While;
close CUR_;

END $$

DELIMITER ;
===================

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.0.18 |
+-----------+
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
no data to fetch from a cursor
3731
February 06, 2009 02:20AM


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.