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;
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;
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;
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;