gpt4 book ai didi

mysql - 缺少声明、设置和 uuid 结尾

转载 作者:行者123 更新时间:2023-11-29 11:56:45 25 4
gpt4 key购买 nike

我想挽救 SHA512 密码中的哈希值以进行训练,但我遇到了错误,而且我真的不知道为什么会有它以及它在哪里。

这是我的程序:

delimiter |
create procedure insert_user(in vuser varchar(35), in vpassword binary(64))
begin
DECLARE salvage binary(16);
SET salvage = uuid();

DECLARE salvagedpassword varbinary(100);
SET salvagedpassword = concat(vpassword, salvage);

DECLARE hashed binary(64);
SET hashed = select SHA512(salvagedpassword);

insert into tbl_user(username, passowrd, salvage_key)
values(vuser, hashed, salvage)
end|

错误显示在 uuid() 之后的昏迷处;它说:缺少结尾

感谢您的帮助!

最佳答案

    delimiter |


drop procedure if exists insert_user |
create procedure insert_user(in vuser varchar(35), in vpassword binary(64))
begin
DECLARE salvage binary(16);
DECLARE salvagedpassword varbinary(100);
DECLARE hashed binary(64);

SET salvage := uuid();
SET salvagedpassword = concat(vpassword, salvage);
select password(salvagedpassword) into hashed;

insert into tbl_user(username, password, salvage_key)
values(vuser, hashed, salvage);
end|

delimiter ;

一些注意事项:

  • 所有 declare 都应该出现在任何赋值之前
  • 没有 SHA15 函数。您可以使用password("plain_password")
  • 我们在插入中的列名 passowrd 中输入错误
  • 我添加了删除程序(如果存在)以使脚本可重新执行

希望有帮助。

关于mysql - 缺少声明、设置和 uuid 结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33067170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com