Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm new to SPs and using Adminer

SET @startDate = initDate;
SET @startTime = initTime;

My stored proc begins like this but throws an error when there is more that one line. initDate and initTime are input vars

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.

Error message Syntax error near 'SET @startTime = initTime' at line 4 13:32:48

Would appreciate any tips

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
161 views
Welcome To Ask or Share your Answers For Others

1 Answer

Normally when defining a stored procedure, you re-define the delimiter beforehand:

DELIMITER $$

CREATE PROCEDURE . . .
BEGIN 
    SET @startDate = initDate;
    SET @startTime = initTime;
    . . .
END$$

DELIMITER ;

It does sound like you might have a problem with the delimiter. I also advise you to wrap the body in BEGIN/END.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...