MySQL存储过程。
发布网友
发布时间:2022-04-08 01:25
我来回答
共1个回答
热心网友
时间:2022-04-08 02:55
drop procere if exists test;
create procere test(inid int,inname varchar(10))
begin
declare num int;
if (select count(*) from t1 where id=inid)=0
then
set num=1;
elseif (select count(*) from t1 where name=inname)=0
then
set num=2;
elseif (select count(*) from t1 where id=inid or name=inname)=0
then
set num=3;
elseif (select count(*) from t1 where id=inid and name=inname)>0
then
delete from t1 where id=inid and name=inname;
end if;
select num;
end;
大致就是这样。