mysql procedures
delimiter // CREATE PROCEDURE [IF NOT EXISTS] nameOfProcedure (IN variable1 [dataType], OUT variable2 [dataType]) BEGIN [statements] END // delimiter ; // Then you can call the procedure with: CALL nameOfProcedure([variable1], @variable2Out); // Then you can use variable2Out; SELECT @variable2Out;
Source: dev.mysql.com