DELIMITER //
CREATE PROCEDURE set_global_count
(
count_var INT
)
BEGIN
SET @count = count_var;
END//
CREATE PROCEDURE increment_global_count()
BEGIN
SET @count = @count + 1;
END//
CALL increment_global_count();
SELECT @count AS count_var
CALL set_global_count(100);
Both of these procedures are sharing the same user variable @count
The user variable can be called with a select statement
As soon as this user disconnects from the server the user variable is gone