Solved

Creating a MYSQL stored procedure

Posted on 2008-10-02
7
321 Views
Last Modified: 2012-05-05
Hi everyone hope you are all well.
Guys im having issues creating a mysql stored procedure.
This is what im doing...

When i execute this, im getting the error:

"You tried to execute an empty string. Please type an SQL command into the SQL edit field and execute again."

I thought this was the right syntax to use, but obviously not.

Im using MySQL version 5.

Any help greatly appreciated.
DELIMITER //

CREATE PROCEDURE getallcurrenttasks()

BEGIN

SELECT * FROM currenttasks_ctk;

END //

DELIMITER ;

Open in new window

0
Comment
Question by:Simon336697
  • 4
  • 3
7 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22627775
please try this:
DELIMITER //
CREATE PROCEDURE getallcurrenttasks()
BEGIN
SELECT * FROM currenttasks_ctk;
END;
//
DELIMITER ;

Open in new window

0
 
LVL 1

Author Comment

by:Simon336697
ID: 22627828
Hi angelll,
thank you for your help :>)
Still no go...ive attached a screen dump for you :>)
angell.jpg
0
 
LVL 1

Author Comment

by:Simon336697
ID: 22627856
It looks like it is not recognizing the DELIMITER keyword ?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22627862
the syntax was to be used on mysql command line.
I never used the mysql query browser for anything else than SELECTs, so I can only guess that either:

* select all the text and hit the run, ro
* put only this code
CREATE PROCEDURE getallcurrenttasks()

BEGIN

SELECT * FROM currenttasks_ctk;

END;

Open in new window

0
 
LVL 1

Author Comment

by:Simon336697
ID: 22627876
Hi Ange, the following worked mate...thank you for your help.
It looks like you have to place the first DELIMITER on the same line as the CREATE.
DELIMITER // CREATE PROCEDURE getallcurrenttasks()

BEGIN

SELECT * FROM currenttasks_ctk;

END;

//

DELIMITER ;

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22627926
good to know!
0
 
LVL 1

Author Comment

by:Simon336697
ID: 22627953
Mate thank you you are awesome......just like your genius colleague 'hielo' on here.
Thank you mate.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now