I'm trying for the first time to create a simple Stored Procedure. I have scouted the net and found several of tutorials, but keep getting some errors when I try to create an INSERT procedure?
I'm trying this:
DELIMITER //
CREATE PROCEDURE my_insert(IN fname VARCHAR(50),IN lname VARCHAR(50))
BEGIN
SET @fname=fname;
SET @lname=lname;
PREPARE STMT FROM
"INSERT INTO users(fname,lname) VALUES (?,?)";
EXECUTE STMT USING @fname,@lname;
END
I get this error: #1064 - 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 'my_insert(IN fname VARCHAR(50),IN lname VARCHAR(50)) BEGIN SET @fname=fn' at line 1
Hoping for help and thanks in advance :-)