It is sometimes required to get the result of a stored procedure
in a variable which can be used later or to output the
result.
To do so, we can use the "OUT" parameter mode while
defining stored procedures.
In the below section, we will be writing a stored procedure to
get the square root of a number returned in an output variable
provided by us.
Stored Procedure Definition:
Store the below stored procedure in a file named
my_sqrt.sql and save it.
DELIMITER $$
DROP PROCEDURE IF EXISTS my_sqrt$$
CREATE PROCEDURE my_sqrt(inp_number INT, OUT
op_number FLOAT)
BEGIN
SET op_number=SQRT(inp_number);
…
Showing entries 1 to 1
Aug
22
2014
Showing entries 1 to 1