I'm trying to create a stored procedure in heidisql (mysql).
CREATE PROCEDURE SP_FORM20_POST(
P_SESSIONID VARCHAR(256)
)
BEGIN
INSERT INTO tbForm20
( SESSIONID, RegDT)
VALUES
( P_SESSIONID, NOW());
END
This is my query. I'm trying to create this procedure, but occur some error:
Error code is 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near'' at line 8".
However, I don't know wrong syntax. What is wrong?
I want to success in heidisql tool. I don't want other db tool. Please help me.
The problem in that query is the semicolon, which is the default query delimiter.
In order to change the delimiter in HeidiSQL, add the DELIMITER client command above the CREATE PROCEDURE
query:
DELIMITER \\
SELECT 1\\
CREATE PROCEDURE ...\\
DELIMITER ;
HeidiSQL also has a procedure designer, with no need to set the delimiter: