I created a stored procedure when I tried to declare a variable to store the returned data from the procedure it gives me declaration error:
ER_PARSE_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 counter int call country(101, counter out) print counter' at line 1
This is the command that I used to declare and store the procedure output:
declare counter int
call country_counter(101,counter out)
print counter
It shows red line under declare keyword
This is the used procedure:
DELIMITER $$
CREATE PROCEDURE `country_counter`(
cntr_code int,
OUT cntr int
)
BEGIN
select cntr = count(id) from users where country_code = cntr_code;
END$$
DELIMITER;
Any idea?