Reputation: 741
I'm trying to add a stored procedure to MySQL scheme.
I get an error ERROR: Error 1193: Unknown system variable 'inner_done'
.
Here's the code
I have to note it doesn't matter which handler is declared last. It's name will be in error, while the first one declared is somehow ok. I even tried playing with the plece to declare handler, e.g. create a new BEGIN
-END
block, but the error still gets me, randomly choosing which handfler to display as "unknown"
Upvotes: 0
Views: 519
Reputation: 633
As commented by @RyanVincent, the error describes inner_done
was not declare:
DECLARE done, inner_done BOOLEAN DEFAULT FALSE;
And wrap your inner loop in a BEGIN - END
block.
Edit: the declare handler statement only defines the handler, so before this is needed the declare statement for the variable which change its value as a condition.
DECLARE inner_done BOOLEAN DEFAULT FALSE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET inner_done = TRUE;
Upvotes: 1