drop procedure if exists pr_t1;
create procedure pr_t1()
begin
     declare _count int default 0;
     select count(*) into _count from tb limit 1;
     if _count=0 or _count is  null then
        select _count;
     else
         select 1;
     end if;
end;

解决方案 »

  1.   

    drop procedure if exists pr_t1;
    create procedure pr_t1()
    begin
         declare _count int default 0;
         select count(*) into _count from tb limit 1;
         if _count=0 or _count is  null then
            select _count;
         else
             你处理的部分
         end if;
    end;
      

  2.   

    drop procedure if exists pr_t1;
    create procedure pr_t1()
    begin
         declare _count int default 0;
         if exists(select i from tb limit 1) then
              处理部分
         else
             select 0;
         end if;
    end;
      

  3.   

    贴出你的存储过程,不应该是null的