
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 Parameters with Special Characters
You cannot give MySQL stored procedure parameter with @ in the beginning. You can give @ sign in user-defined variables.
Following is the syntax −
SET @yourVariableName=yourValue;
Let us implement the above syntax to correctly place @sign −
mysql> DELIMITER // mysql> CREATE PROCEDURE declare_Variable(IN StudentName varchar(100)) BEGIN SET @Name=StudentName; SELECT @Name; END // Query OK, 0 rows affected (0.12 sec) mysql> DELIMITER ;
Now you can call stored procedure with the help of CALL command −
mysql> call declare_Variable('John Smith');
This will produce the following output −
+------------+ | @Name | +------------+ | John Smith | +------------+ 1 row in set (0.00 sec) Query OK, 0 rows affected, 1 warning (0.03 sec)
Advertisements