Search code examples
mysqlmysql-error-1064

MySQL Create Procedure Yields Error 1064


Good Morning,

I'm creating the following procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `insert_inventory_audit`(
IN  `pitem_id`      int,
IN  `puser_id`      int,
IN  `pfield_name`   varchar(265),
IN  `pold_value`    mediumtext,
IN  `pnew_value`    mediumtext
)
BEGIN

INSERT INTO inventory_audit (item_id, user_id, field_name, old_value, new_value)
VALUES (pitem_id, puser_id, pfield_name, pold_value, pnew_value);
END$$

It is being copied to our new server running MySQL 5.5.19 from our old server running MySQL 5.0.45.

When I excecute the above code on the new server, I recieve the following 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 '' at line 11

Does this mean that each entry inside the VALUES parentheses must be surrounded by '' eg. 'pitem_id' ?


Solution

  • You need to have DELIMITER $$ before the create statement.