Bug #24140 MySQL Cursor creation
| Submitted: | 9 Nov 2006 12:55 | Modified: | 9 Nov 2006 14:16 |
|---|---|---|---|
| Reporter: | Uma Anand Ilango | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.1 | OS: | |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | MySql Cursor Declaration | ||
[9 Nov 2006 14:16]
Valeriy Kravchuk
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug. Please, read the manual on possible reasons for your problem: http://dev.mysql.com/doc/refman/5.0/en/declare.html Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/ Thank you for your interest in MySQL.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
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.
Description: Hi, I am trying to create a cursor with a select statement. I need to create a cursor to retrieve all employees belonging to a specific manager. I have a cursor which has all the managers list. The statements are as below. How to repeat: DELIMITER $$ CREATE PROCEDURE `Invoke`() BEGIN DECLARE cur1 CURSOR FOR SELECT Id FROM Managers; DECLARE done INT DEFAULT 0; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; DECLARE MgrId varchar(50); DECLARE EmpId varchar(50); OPEN cur1; REPEAT FETCH cur1 INTO MgrId; IF NOT done THEN <UPDATE Statement on Mgr table> DECLARE cur2 CURSOR FOR SELECT Id FROM Employees Where Id in (SELECT EmployeeId from ManagerEmployeeMapping where ManagerId = MgrId); OPEN cur2; REPEAT FETCH cur2 into EmpId; IF NOT done THEN <UPDATE Statement on Emp Table> END IF; UNTIL done END REPEAT; CLOSE cur2; END IF; UNTIL done END REPEAT; CLOSE cur1; END$$ DELIMITER; Suggested fix: Some suggest if there is a fix to this problem.