
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 calling with INT and VARCHAR values
To call a stored procedure, you can use CALL command. Following is the syntax −
CALL yourStoredProcedureName(parameter if any);
Let us first create a sample procedure. Following is the query to create a stored procedure. Here, we have set two values, one is an INT and another VARCHAR −
mysql> DELIMITER // mysql> CREATE PROCEDURE CALL_PROC(Id int,Name varchar(40)) BEGIN SELECT CONCAT('You have entered the Id which is=',Id); SELECT CONCAT('You have entered the Name which is=',Name); END // Query OK, 0 rows affected (0.21 sec) mysql> DELIMITER ;
Following is the query to call a stored procedure in MySQL −
mysql> CALL CALL_PROC(1001,'Chris');
This will produce the following output −
+------------------------------------------------+ | CONCAT('You have entered the Id which is=',Id) | +------------------------------------------------+ | You have entered the Id which is=1001 | +------------------------------------------------+ 1 row in set (0.00 sec) +----------------------------------------------------+ | CONCAT('You have entered the Name which is=',Name) | +----------------------------------------------------+ | You have entered the Name which is=Chris | +----------------------------------------------------+ 1 row in set (0.02 sec) Query OK, 0 rows affected, 1 warning (0.04 sec)
- Related Questions & Answers
- Calling Stored Procedure inside foreach PHP Codeigniter
- Create a table inside a MySQL stored procedure and insert a record on calling the procedure
- MySQL Stored procedure to declare two values and perform mathematical operation
- How can a MySQL stored procedure call another MySQL stored procedure inside it?
- MySQL stored-procedure: out parameter?
- MySQL stored procedure return value?
- Create a stored procedure with delimiter in MySQL
- Insert values in two tables with a single stored procedure call in MySQL
- How to correctly use delimiter in a MySQL stored procedure and insert values?
- MySQL Sum Query with IF Condition using Stored Procedure
- Create variables in MySQL stored procedure with DECLARE keyword
- Working with WHERE IN() in a MySQL Stored Procedure
- MySQL Stored Procedure to update records with certain condition?
- Display description of MySQL stored procedure
- What is stored procedure and how can we create MySQL stored procedures?
Advertisements