sql - SQL 存储过程 OUT 总是返回 Null
问题描述
我正在尝试在 SQL 中创建登录并使用存储过程来捕获登录信息。
即使在 phpmyadmin 上执行存储过程,我的输出参数总是返回 Null,我不知道为什么。
userid
是我的 OUT 参数,我收到了电子邮件和密码,其余字段为空字符串。
BEGIN
set @userid = (select id from `user` where `email` = email and `password` = password and statusId = 8);
if @userid is not null
then
set @statu = 9;
elseif @userid is null
then
set @statu = 10;
end if;
call loginHistory(@userid, email, @statu, ip4, ip6, deviceType, appVer);
set @userid = userid;
END
谢谢
解决方案
改变
set @userid = userid;
至
SET userid = @userid;
userid
并且@userid
是不同的东西。
如果这还不够,请向我们展示声明的其余部分。
推荐阅读
- java - java中的并发有序列表
- postgresql - 将 Postgres Primary/Standby 从 11 升级到 12
- django - 如何创建查询以在 django 中列出类别
- java - 找不到符号方法getcontext
- c# - 是否可以在特定的 Web api 控制器中禁用应用程序洞察跟踪?
- typescript - TypeScript 无法识别未知类型和 Promise 类型的联合
- r - 尝试有条件地读取 R 中的文件时出错
- java - Jackson ObjectMapper 的日期和时间戳序列化
- google-sheets - Google 表格 - 将图表链接到另一张表格
- amazon-web-services - 具有大量 Parquet 文件的 S3 存储桶的灾难恢复