SidC
SidC

Reputation: 3203

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' ?

Upvotes: 1

Views: 5757

Answers (2)

kcdragon
kcdragon

Reputation: 1733

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

Upvotes: 5

Marc B
Marc B

Reputation: 360602

You didn't change the delimiter from the default ;, so the ; you're using there is actually terminating the procedure, not the query.

DELIMITER $$   <--- add this line
CREATE ....
...
END$$

Upvotes: 4

Related Questions