Solved

Creating a MYSQL stored procedure

Posted on 2008-10-02
7
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unable to insert record into a table 2 57
Showing random records from database 10 53
CLI command keep running after close 7 73
Survey branching tutorial 11 77
Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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