gpt4 book ai didi

mysql - 在 Sequel Pro MariaDB 上保存 MySql 函数

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

我有一个可以在我的脚本中运行的函数,但是当我尝试在我的 Sequel Pro MariaDB 上运行它以将其添加到函数列表中时,我收到了一堆错误。

drop function if exists related_count;
create function related_count(parent int(11)) returns int(11)
begin
declare count int(11) default 0;
while parent!=0 and count<10 do
set count=count+1;
set parent=(select related from category where id=parent);
end while
return count
end

enter image description here

最佳答案

  • 您需要一对 DELIMITER 语句。

  • 更多语句需要终止;

在文档和本论坛中查找 CREATE FUNCTION 的示例。

关于mysql - 在 Sequel Pro MariaDB 上保存 MySql 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50017201/

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