mysql>
mysql> delimiter $$
mysql>
mysql> CREATE PROCEDURE myProc()
-> BEGIN
-> DECLARE a INT DEFAULT 2;
-> DECLARE b INT DEFAULT 3;
-> DECLARE c FLOAT;
->
-> SET c=a+b; SELECT 'a+b=',c;
-> SET c=a/b; SELECT 'a/b=',c;
-> SET c=a*b; SELECT 'a*b=',c;
->
-> END$$
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> delimiter ;
mysql>
mysql> call myProc();
+------+------+
| a+b= | c |
+------+------+
| a+b= | 5 |
+------+------+
1 row in set (0.00 sec)
+------+----------+
| a/b= | c |
+------+----------+
| a/b= | 0.666667 |
+------+----------+
1 row in set (0.02 sec)
+------+------+
| a*b= | c |
+------+------+
| a*b= | 6 |
+------+------+
1 row in set (0.02 sec)
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> drop procedure myProc;
Query OK, 0 rows affected (0.00 sec)
mysql>