create table userinfo
(
username char(10),
sex char(4),
phone char(10)
)
declare
num1 int;
username1 char(10);
cursor cursor_userinfo is select count(*)num,username from username
group by username;
begin
open cursor_userinfo;
loop
exit when cursor_userinfo%notfound or cursor_userinfo%notfound is null;
fectch cursor_userinfo into num1,username1;
declare cursor cursor_second is select * from userinfo where username=username1;
open cursor_second;
while num1>1 loop
delete from userinfo where current of cursor_second
set num1=num1-1;
end loop;
close cursor_second;
end loop;
end cursor_userinfo;
end;为什么老出错,请帮忙指点,谢谢
(
username char(10),
sex char(4),
phone char(10)
)
declare
num1 int;
username1 char(10);
cursor cursor_userinfo is select count(*)num,username from username
group by username;
begin
open cursor_userinfo;
loop
exit when cursor_userinfo%notfound or cursor_userinfo%notfound is null;
fectch cursor_userinfo into num1,username1;
declare cursor cursor_second is select * from userinfo where username=username1;
open cursor_second;
while num1>1 loop
delete from userinfo where current of cursor_second
set num1=num1-1;
end loop;
close cursor_second;
end loop;
end cursor_userinfo;
end;为什么老出错,请帮忙指点,谢谢
(select max(rowid) from userinfo B where a.user_name = b.user_name )