- 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 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)
Advertisements