gpt4 book ai didi

mysql 过程创建

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

我正在 mysql 中创建一个过程,如下所示。

DELIMETER $$
create procedure getname(IN rll int,OUT nm varchar(30))
BEGIN
select name into nm from student where roll=rll
END
$$
DELIMETER ;

但是它不起作用,我收到如下错误消息:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimeter$$ create procedure getname(IN rll int,OUT nm varchar(30)) BEGIN select' at line 1.

请指出我可能出错的地方。

最佳答案

首先,DELIMETER $$ 一词有语法错误,请将其更改为 DELIMITER

您可以尝试按照 MySql documentations 中所述创建过程。 :

DELIMITER //
create procedure getname(IN rll int,OUT nm varchar(30))
BEGIN
select name into nm from student where roll=rll;
END//
DELIMITER ;

关于mysql 过程创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32964463/

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