铁头娃呀 2018-08-14 10:03 采纳率: 50%
浏览 610
已结题

求个大佬帮忙改下这段mysql的存储过程 一直报错 改了半天

delimiter //
create procedure pp()
declare aa varchar(10);
declare bb varchar(10);
declare cc varchar(10);
declare dd varchar(10);
declare ee varchar(10);
declare ff varchar(10);
declare gg varchar(10);
declare ii int not null;
deciare c1 cursor

selecr * from
(select id id1,a from t3 where id=1) a,
(select id id2,b from t3 where id=2) b,
(select id id3,c from t3 where id=3) c,
(select id id4,d from t3 where id=4) d,
(select id id5,e from t3 where id=5) e,
(select id id6,f from t3 where id=6) f,
(select id id7,g from t3 where id=7) g;
open c1;
fetch next from c1 into aa,bb,cc,dd,ee,ff,gg,ii;
declare x int;
begin
for i in c1;
read_loop:Loop
select count(m) into x
from (
select i.id1 m
union
select i.id2
union
select i.id3
union
select i.id4
union
select i.id5
union
select i.id6
union
select i.id7
);
if
x/7>0.5 then
insert into t4 values(i.a,i.b,i.c,i.d,i.e,i.f,i.g);
commit;
end if;
leave read_loop;
end loop read_loop;
close c1;
end;
//
本意是用游标找到t3表的的笛卡尔积中每行数据每个字段id重复不超过一半的数据然后插入到t4表中 但是写出来一直报错 新手 一直改然后一直报错 哪位哥哥姐姐看下这个怎么修正能运行
帮帮忙 改完能用的话我可以再给20c 拜谢

  • 写回答

2条回答

  • Maudlili 2018-08-17 09:18
    关注

    ... 【deciare c1 cursor】改成declare ,【selecr * from 】改成select...另外问一下【for i in c1;】i是什么呀?;

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型