我正在尝试插入一个值,以防未插入,否则尝试更新其某些字段。只使用了一个变量。尽管 ion 调用存储过程,但它显示插入了一行,但未插入值。请帮助我,第一次尝试 SP。
这是我的存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertLocation`(in IpAddress varchar(45))
BEGIN
if (SELECT count(*) as count
FROM mbuzzz.location_byhits
where IpAddress = IpAddress
having count>0)
then
UPDATE location_byhits SET Hits=Hits+1 where IpAddress=IpAddress;
else
insert into location_byhits(IpAddress,Date_current)
values (IpAddress,CURTIME());
End if ;
end
Run Code Online (Sandbox Code Playgroud)