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
Selected Reading
Declare syntax error in MySQL Workbench?
The DECLARE syntax must between BEGIN and END. The syntax is as follows −
BEGIN DECLARE yourVariableName1 dataType, DECLARE yourVariableName2 dataType, . . . . END
Here is the query to avoid DECLARE syntax error in MySQL −
mysql> DELIMITER // mysql> create procedure declare_Demo() -> BEGIN -> DECLARE Name varchar(100); -> SET Name: ='John'; -> SELECT Name; -> END -> // Query OK, 0 rows affected (0.17 sec) mysql> DELIMITER ;
Call the stored procedure with the help of CALL command. The syntax is as follows −
CALL yourStoredProcedureName();
The query is as follows −
mysql> call declare_Demo();
The following is the output −
+------+ | Name | +------+ | John | +------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec)
Advertisements
