I most likely have a syntax issue (SQL command and error copied below) – I am using MySQL v5.1.63 on Ubuntu 11 (dbName is the name of the database, the fields mentioned are in the USERS table with the appropriate data types/lengths). Any suggestions to troubleshoot this would be welcome.
use dbName;
DELIMITER //
CREATE PROCEDURE sp_insertTest
(
IN p_ID INT(11),
IN p_UserID VARCHAR(40),
IN p_Email VARCHAR(30)
)
BEGIN
INSERT INTO USERS
(
ID,
UserID,
Email
)
VALUES
(
p_ID,
p_UserID,
p_Email
)
END//
DELIMITER;
I am getting an error when I source the file containing the statement above:
ERROR 1064 (42000): 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 'END' at line 32
ERROR 1064 (42000): 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 'DELIMITER' at line 1
Thanks in advance.
Try adding a space after
END//andDELIMITER;, and also try a semicolon after the inserted values. The corrected procedure is: