MariaDB社区

标题: mysql 存储过程错误 [打印本页]

作者: x_iaoyuer    时间: 2009-3-6 17:50
标题: mysql 存储过程错误
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
作者: x_iaoyuer    时间: 2009-3-6 17:51
请高手帮我看一下哪里有问题,谢谢了 我对mysql 的存储过程实在是不懂  谢谢各位大虾了
作者: x_iaoyuer    时间: 2009-3-6 17:52
自己顶下
作者: kider    时间: 2009-3-6 19:24
提示什么错?
作者: only_dang    时间: 2009-3-17 11:56
你的数据库表是什么 ,提示的错误是什么?不然这怎么找




欢迎光临 MariaDB社区 (http://123.56.88.72/) Powered by Discuz! X3.2