使用“ if”和“ else”存储过程MySQL
||
尝试创建此存储过程时遇到一些困难,欢迎任何帮助:
create procedure checando(in nombrecillo varchar(30), in contrilla varchar(30), out resultado int)
begin
if exists (select * from compas where nombre = nombrecillo and contrasenia = contrilla) then
set resultado = 0;
else if exists (select * from compas where nombre = nombrecillo) then
set resultado = -1;
else
set resultado = -2;
end if;
end;
我正在处理的表是:
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| Nombre | varchar(30) | YES | | NULL | |
| contrasenia | varchar(30) | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+
没有找到相关结果
已邀请:
3 个回复
闪票仇门韧
,或者您需要need3ѭ:
部窖空
感秆暴壳
ѭ10as,以达到
。
ps:以防万一有人需要这种方式。