Create a procedure with out parameter
DELIMITER $$ CREATE PROCEDURE TEST (OUT NUMBER1 INTEGER) BEGIN DECLARE NUMBER2 INTEGER DEFAULT 100; SET NUMBER1 = NUMBER2; END$$ DELIMITER ; CALL TEST (@NUMBER) ; SELECT @NUMBER;