![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL Stored procedure to declare two values and perform mathematical operation
Let us first create a stored procedure −
mysql> delimiter // mysql> create procedure declare_demo_sp() begin declare Value1 int; declare Value2 int; set Value1=100; set Value2=2000; select Value1,Value2,Value1*Value2 as MultiplicationResult; end // Query OK, 0 rows affected (0.00 sec) mysql> delimiter ;
Call a stored procedure using CALL command −
mysql> call declare_demo_sp();
This will produce the following output −
+--------+--------+----------------------+ | Value1 | Value2 | MultiplicationResult | +--------+--------+----------------------+ | 100 | 2000 | 200000 | +--------+--------+----------------------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec)
Advertisements