- 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
Use delimiter correctly in a MySQL stored procedure to avoid BEGIN/END statements errors
Such errors arise when you avoid using the DELIMITER concept. Let us see an example and run a query for stored procedure −
mysql> DELIMITER // mysql> CREATE PROCEDURE correct_procedure() BEGIN SELECT 'Hello MySQL !!!'; END // Query OK, 0 rows affected (0.12 sec) mysql> DELIMITER ;
Following is the syntax to call the stored procedure −
call yourStoredProcedureName();
Call the stored procedure using CALL command −
mysql> call correct_procedure();
This will produce the following output −
+-----------------+ | Hello MySQL !!! | +-----------------+ | Hello MySQL !!! | +-----------------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.02 sec)
Advertisements