0% found this document useful (0 votes)
6 views

Assignment 17

The document describes the creation of a MySQL stored procedure named 'AddTwoNumbers' that takes two input integers and outputs their sum. After defining the procedure, it is called with the values 5 and 7, resulting in an output of 12. The procedure successfully computes the sum and stores it in the variable '@result'.

Uploaded by

Mrinmoy Pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Assignment 17

The document describes the creation of a MySQL stored procedure named 'AddTwoNumbers' that takes two input integers and outputs their sum. After defining the procedure, it is called with the values 5 and 7, resulting in an output of 12. The procedure successfully computes the sum and stores it in the variable '@result'.

Uploaded by

Mrinmoy Pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

mysql> use assignment_17;

Database changed
mysql>
mysql> DELIMITER //
mysql> CREATE PROCEDURE AddTwoNumbers(IN in_num1 INT, IN in_num2 INT, OUT out_sum
INT)
-> BEGIN
-> SET out_sum = in_num1 + in_num2;
-> END //
Query OK, 0 rows affected (0.00 sec)

mysql> DELIMITER ;
mysql>
mysql> CALL AddTwoNumbers(5, 7, @result);
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @result;


+---------+
| @result |
+---------+
| 12 |
+---------+
1 row in set (0.00 sec)

You might also like