Use DEFAULT Statement in Procedure

The Tutorial illustrate an example 'Use DEFAULT Statement in Procedure'. To
understand 'Default Statement in Procedure', we create a procedure 'abc'. The BEGIN
statement indicate the beginning of an SQL declare section. The Declare
is used to define a variable 'x', 'y' and 'z ', whose data type is integer
type. The variable x and y set to a default value of '15'.The variable 'z'
assigned the sum value of variable 'x' and 'y'. An SQL declare variable
end with an END statement.
select z : The select z returns you the sum value of variable
'x' and 'y' into 'z'.
Create Procedure
delimiter $$
create procedure abc()
BEGIN
DECLARE x int DEFAULT 15;
DECLARE y int DEFAULT 15;
DECLARE z int;
set z = x+y;
select z;
END$$
delimiter ;
|
Call Procedure
To invoke a procedure 'abc', we use call abc ( ) given below:
Result
+------+
| z |
+------+
| 30 |
+------+
|

|