- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How can I create MySQL stored procedure with INOUT parameter?
Following example will demonstrate MySQL stored procedure with INOUT parameter −
mysql> DELIMITER // ; mysql> Create PROCEDURE counter(INOUT count INT, IN increment INT) -> BEGIN -> SET count = count + increment; -> END // Query OK, 0 rows affected (0.03 sec)
Here, ‘count’ is the INOUT parameter, which can store and return values and ‘increment’ is the IN parameter, which accepts the values from user.
mysql> DELIMITER ; mysql> SET @counter = 0; Query OK, 0 rows affected (0.00 sec) mysql> CALL counter(@Counter, 1); Query OK, 0 rows affected (0.00 sec) mysql> Select @Counter; +----------+ | @Counter | +----------+ | 1 | +----------+ 1 row in set (0.00 sec) mysql> CALL counter(@Counter, 5); Query OK, 0 rows affected (0.00 sec) mysql> Select @Counter; +----------+ | @Counter | +----------+ | 6 | +----------+ 1 row in set (0.00 sec)
- Related Articles
- How can I create MySQL stored procedure with IN parameter?
- How can I create MySQL stored procedure with OUT parameter?
- MySQL stored-procedure: out parameter?
- What is stored procedure and how can we create MySQL stored procedures?
- How can I create a stored procedure to insert values in a MySQL table?
- How can I create a stored procedure to delete values from a MySQL table?
- How can I create a stored procedure to update values in a MySQL table?
- How can I create a MySQL stored procedure that returns multiple values from a MySQL table?
- How can a MySQL stored procedure call another MySQL stored procedure inside it?
- Create a stored procedure with delimiter in MySQL
- How can we create MySQL stored procedure to calculate the factorial?
- How can we invoke MySQL stored procedure?
- Create variables in MySQL stored procedure with DECLARE keyword
- How can I get all the records of a table by passing its name as the parameter of MySQL stored procedure?
- How can we alter a MySQL stored procedure?

Advertisements