Thanks for your reply. Actually, I want to do the following. But I have no idea how to do it.
create procedure a() begin declare ... declare c1 cursor for select ... declare contine handler for not found set x=1; declare c2 cursor for select ... declare contine handler for not found set y=1; create temporary table .... insert into temporary table .... open c1 (c1 will join table a and temp table to get the result) close c1 open c2 (c2 will join table b and temp table to get the result) close c2 end On Feb 11, 2008 11:08 AM, Paul DuBois <[EMAIL PROTECTED]> wrote: > > At 10:57 AM +0800 2/11/08, Rilawich Ango wrote: > >HI all, > > > > How can a store procedure to contain 2 cursors? Any advise? > > > >ango > > > >create procedure a() > >begin > > declare ... > > declare c1 cursor for select ... > > declare contine handler for not found set x=1; > > declare c2 cursor for select ... > > declare contine handler for not found set y=1; > >.... > > http://dev.mysql.com/doc/refman/5.0/en/cursors.html: > > "Cursors must be declared before declaring handlers. Variables and > conditions must be declared before declaring either cursors or > handlers." > > You have a handler declared before a cursor. > > -- > Paul DuBois, MySQL Documentation Team > Madison, Wisconsin, USA > MySQL AB, www.mysql.com > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]