Solved

Creating a MYSQL stored procedure

Posted on 2008-10-02
7
313 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
Comment Utility
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
Comment Utility
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
Comment Utility
It looks like it is not recognizing the DELIMITER keyword ?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
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
Comment Utility
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]
Comment Utility
good to know!
0
 
LVL 1

Author Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
Creating and Managing Databases with phpMyAdmin in cPanel.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

6 Experts available now in Live!

Get 1:1 Help Now