Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Can we use semicolon as a MySQL DEMILITER?
No, we cannot. If you still did it, then stored procedure won’t get created. Therefore, first you need to change your DELIMITER from semicolon(;) to others like (// ,??..etc). Following is the syntax −
DELIMITER // CREATE PROCEDURE yourProcedureName() BEGIN yourStatement1, . . . . N END // DELIMITER ;
Let us implement the above syntax in order to create a stored procedure −
mysql> DELIMITER //
mysql> CREATE PROCEDURE get_Message()
-> BEGIN
-> SELECT CONCAT("HELLO"," ","MYSQL USERS");
-> END
-> //
Query OK, 0 rows affected (0.23 sec)
mysql> DELIMITER ;
Now you can call the stored procedure with the help of CALL command −
mysql> CALL get_Message();
Output
This will produce the following output −
+-----------------------------------+
| CONCAT("HELLO"," ","MYSQL USERS") |
+-----------------------------------+
| HELLO MYSQL USERS |
+-----------------------------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.01 sec) Advertisements
