views:

11

answers:

1

I am defining a stored procedure and it throws an error at DECLARE variable.

CREATE PROCEDURE test_proc()
BEGIN

DECLARE venueid VARCHAR(50);
DECLARE i INT;

Heres the Error -

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 'DECLARE venueid VARCHAR(50);

Anyone know whats going on?

A: 

try this:

drop procedure if exists test_proc;

delimiter #

create procedure test_proc()
begin

declare venueid varchar(50);
declare i int default 0;

  -- do more stuff

end #

delimiter ;

call test_proc();
f00