Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

Creating a MYSQL stored procedure

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
Simon336697
Asked:
Simon336697
  • 4
  • 3
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please try this:
DELIMITER //
CREATE PROCEDURE getallcurrenttasks()
BEGIN
SELECT * FROM currenttasks_ctk;
END;
//
DELIMITER ;

Open in new window

0
 
Simon336697Author Commented:
Hi angelll,
thank you for your help :>)
Still no go...ive attached a screen dump for you :>)
angell.jpg
0
 
Simon336697Author Commented:
It looks like it is not recognizing the DELIMITER keyword ?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Simon336697Author Commented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
good to know!
0
 
Simon336697Author Commented:
Mate thank you you are awesome......just like your genius colleague 'hielo' on here.
Thank you mate.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now