Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can i used Declare as well as set in my MYSQL WORKBENCH for checked my storeprocedure output in new Query window...

It give error like Syntax error, unexpected Declare_sym...at first line with cross sign

I am using following code for it..

Declare StartDate datetime

set StartDate = '2013-07-01';

and i also tried DELIMITER $$ at first line also but still gating errors..

Please help me fast for it.. it is so simple i know but i am new in my sql so...
Posted
Updated 28-Oct-21 21:56pm

after googling i get my answer..

Put Declare statement must in between Begin and end statement as well as it has first statement after begin statement

I getting ans from this wonderful site..

http://dev.mysql.com/doc/refman/5.0/en/declare.html[^]
 
Share this answer
 
DROP PROCEDURE IF EXISTS `PROCEDURENAME`;
DELIMITER$$
CREATE PROCEDURE `PROCEDURENAME`()
BEGIN
DECLARE

SET
END $$
DELIMITER;



Follow the above pattern
 
Share this answer
 
Comments
CHill60 29-Oct-21 4:10am    
You have added nothing to the solution that was posted here 8 years ago. If you are going to answer ancient questions please ensure that you are bringing something new to the thread - or stick to newer questions where the OP still needs help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900