MySQL社区

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 4107|回复: 4
打印 上一主题 下一主题

mysql 存储过程错误

[复制链接]
跳转到指定楼层
1#
发表于 2009-3-6 17:50:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
drop procedure if exists sp_ylc;
create procedure sp_ylc()
begin
     DECLARE @userid INT;   
     DECLARE @opsid INT;
     DECLARE @cunm INT;
     DECLARE @moduleid INT;   
     DECLARE @mduname VARCHAR(200);
     DECLARE @i INT;
     DECLARE @content VARCHAR(500);
     DECLARE @time datetime ;
     DECLARE @objectID INT ;
     DECLARE @copt INT;
     DECLARE @copt INT;
     DECLARE @objlist VARCHAR(500);
     DECLARE @operarry1 VARCHAR(500);
     DECLARE @operarry2 VARCHAR(500);
     DECLARE @content0 VARCHAR(500);
     DECLARE @contentp VARCHAR(500);
     DECLARE @ctime datetime ;
     DECLARE @ipd INT;
     DECLARE @ptimes datetime;
     DECLARE @stimo datetime;
     DECLARE @ent VARCHAR(500);
     DECLARE @iupoi INT;
     DECLARE @ipok INT;
Select @userid = I_userID,@opsid=I_operationID,@cunm=count(*) from space_operation_record where status<>0 group by I_userID,I_operationID;
while @cunm > 0 do
   select @cunm = @cunm -1;
    Select @moduleid=I_moduleID from space_operation where status<>0 and [email=ID=@opid]ID=@opid[/email];
    if @moduleid > 0 then
      Select @mduname=Nvc_name from space_module where status<>0 and [email=ID=@moduleid]ID=@moduleid[/email];
      if @mduname > 0 then
        select  @i=0;
         Select @content=Nvc_content,@id=ID,@time=createtime,@objectID=I_objectID,@copt=count(*) from space_operation_record where status<>0 and I_operationID=opid and I_userID=userid;
         if copt > 0 then
            if @mduname = '日志' then
               while @copt > 0 do
                select @copt = @copt -1;
            INSERT INTO space_operation_stat(I_operationID,I_userID,Nvc_content,D_stattime,Createtime) VALUES ([email=]'@id','@userid','@content','@time',now[/email]());
               end while;
            else
                while @Copt > 0 do
             if @i > 5 then
              break;
             end if;
             select @objlist  = CONCAT(@objectID,CONCAT(@objectID,','));
            select  @operarry1 = substring_index(@content,'|',1);
            select  @operarry2 = substring_index(@content,'|',-1);
            select  @content0 =CONCAT(@operarry2,SPACE(1));
            select @copt = @copt -1;
               select @i = @i + 1;
                end while;
                 select @objlist = substring(@objlist,'-1');
                if @content0 is null then
                  select @contentp  = CONCAT(@operarry1,@content0);
                  Select @ctime=createtime,@ipd=ID from space_operation_record where status<>0 and [email=I_operationID=@opid]I_operationID=@opid[/email] order by createtime desc limit 0,1;
                  if @ipd > 0 then
                    INSERT INTO space_operation_stat(I_operationID,I_userID,Nvc_content,D_stattime,Createtime,Nvc_objlist) VALUES([email=]'@ipd','@userid','@contentp','@ctime',now(),'@objlist'[/email]);
                  end if;
                end if;
            end if;
         end if;
      end if;   
      
    end if;
end while;
UPDATE space_operation_play SET status=0;
UPDATE space_operation_display SET status=0;
Select @ptimes=createtime from space_operation_stat where status<>0 order by createtime desc limit 0,1;
if @ptimes > 0 then
Select @stimo=D_stattime,@ent=Nvc_content,@iupoi=I_userID,@ipok=ID from space_operation_stat where status<>0  and [email=createtime=]createtime='@ptimes'[/email]  order by D_stattime desc limit 0,30;
   if @stimo > 0 then
    INSERT INTO space_operation_play(I_statID,Nvc_content,D_stattime,I_userID,Createtime) VALUES ([email=]'@ipok','@ent','@stimo',now[/email]());
   end if;
end if;

end
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享淘帖 顶 踩
2#
 楼主| 发表于 2009-3-6 17:51:48 | 只看该作者
请高手帮我看一下哪里有问题,谢谢了 我对mysql 的存储过程实在是不懂  谢谢各位大虾了
3#
 楼主| 发表于 2009-3-6 17:52:09 | 只看该作者
自己顶下
4#
发表于 2009-3-6 19:24:53 | 只看该作者
提示什么错?
only_dang 该用户已被删除
5#
发表于 2009-3-17 11:56:03 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|申请友链|小黑屋|Archiver|手机版|MySQL社区 ( 京ICP备07012489号   
联系人:周生; 联系电话:13911732319

GMT+8, 2024-6-26 15:01 , Processed in 0.085183 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表