
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
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 Articles
- Create a table inside a MySQL stored procedure and insert a record on calling the procedure
- Calling Stored Procedure inside foreach PHP Codeigniter
- MySQL Stored procedure to declare two values and perform mathematical operation
- Insert values in two tables with a single stored procedure call in MySQL
- How can a MySQL stored procedure call another MySQL stored procedure inside it?
- Create a stored procedure with delimiter in MySQL
- How to correctly use delimiter in a MySQL stored procedure and insert values?
- MySQL stored-procedure: out parameter?
- MySQL stored procedure return value?
- 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?
- Increase and decrease row value by 1 in MySQL with Stored Procedure?
- Display description of MySQL stored procedure

Advertisements