Your problem is that you put DECLARE in the wrong place.
DECLARE Syntax
DECLARE is permitted only inside a BEGIN ... END compound statement
and must be at its start, before any other statements.
More over the declarations must follow a specific order:
- variables and conditions
- cursors
- handlers
That being said, this will do just fine
DECLARE parms VARCHAR(32);
DECLARE exit_loop INT;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET exit_loop = TRUE;
SET parms = CONCAT('s','sa');
Let's try it:
mysql> DELIMITER //
mysql> CREATE PROCEDURE myproc()
-> BEGIN
-> DECLARE parms VARCHAR(32);
-> DECLARE exit_loop INT;
-> DECLARE CONTINUE HANDLER FOR NOT FOUND SET exit_loop = TRUE;
->
-> SET parms = CONCAT('s','sa');
-> SELECT parms;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql> CALL myproc();
+-------+
| parms |
+-------+
| ssa |
+-------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)