where DeviceId =@did;?
@did是什么变量?

解决方案 »

  1.   

    存储过程的输入参数,用来接收DeviceId的值。在select语句的where条件里面用到。
      

  2.   

    是DID吧
    where DeviceId =did
      

  3.   

    @did有值吗?
    DID、did是一样的,传入的值
      

  4.   

    是一样的值,如字符串'123456',但是得到的@ret的值是Null。
      

  5.   

    在MYSQL中运行
    select ROWNUM i 
     from  (select (@mycnt:=@mycnt + 1) as ROWNUM, DeviceId from dev_info_table order by  DeviceId) as A 
     where DeviceId ='123456'
    结果是什么
      

  6.   

    drop procedure if exists rownumber;
    create procedure rownumber( IN did varchar(255) , OUT mypos int )
    Begin
    declare mycnt int;
    set @mycnt=0;
    select ROWNUM into mypos 
    from  (select (@mycnt:=@mycnt + 1) as ROWNUM, DeviceId from dev_info_table order by  DeviceId) as A 
    where DeviceId =@did;
    End
    其中,did是设备号,mypos是该设备号对应记录的行号。这个存储过程创建成功,但是在如下调用方式中返回结果为空: