问题描述
我是 SP 的新手并使用 Adminer
I'm new to SPs and using Adminer
SET @startDate = initDate;
SET @startTime = initTime;
我的存储过程是这样开始的,但是当超过一行时会引发错误.initDate 和 initTime 是输入变量
My stored proc begins like this but throws an error when there is more that one line. initDate and initTime are input vars
这看起来像是分隔符的某种问题,好像两个赋值都在一行上用 , 分隔符将错误进一步转移到 SP.
It looks like some sort of issue with the delimiter as if both assignments go on one line with a , separator the error shifts further in to the SP.
错误信息第 4 行 13:32:48
Error message Syntax error near 'SET @startTime = initTime' at line 4 13:32:48
希望得到任何提示
推荐答案
通常在定义存储过程时,您会预先重新定义分隔符:
Normally when defining a stored procedure, you re-define the delimiter beforehand:
DELIMITER $$
CREATE PROCEDURE . . .
BEGIN
SET @startDate = initDate;
SET @startTime = initTime;
. . .
END$$
DELIMITER ;
听起来您的分隔符可能有问题.我还建议您将正文包裹在 BEGIN
/END
中.
It does sound like you might have a problem with the delimiter. I also advise you to wrap the body in BEGIN
/END
.
这篇关于Adminer 上的 MYSQL 存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!