Solved

Creating a MYSQL stored procedure

Posted on 2008-10-02
7
337 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 143

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 143

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 143

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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