日期:2014-05-16 浏览次数:20754 次
create procedure pro_hzcount() begin declare cur_no,y int; declare cur_name varchar(20); declare cursor_1 cursor for SELECT name,count(name) FROM t1 group by name; declare continue handler for not found set y=1; open cursor_1; repeat fetch cursor_1 into cur_name,cur_no; update t1 set no=cur_no where name=cur_name; until y=1 end repeat; close cursor_1; end;