MySQL Forums :: Stored Procedures :: Problem with stored procedures on phpmyadmin


Advanced Search

Re: Problem with stored procedures on phpmyadmin
Posted by: Andrew James ()
Date: August 16, 2016 02:37PM

I've rewrote my stored procedure like this in mysql:

CREATE PROCEDURE GetAllFiles()
BEGIN

DECLARE CheckExists int;
DECLARE specialty CONDITION FOR SQLSTATE '45000';
SET CheckExists = 0;
# checking to see how many files are there and if its not there then display the message
SELECT COUNT(files.Files,Users.FirstName,Users.LastName,Users.EmailAddress) INTO CheckExists from
files,Users where files.UserID = Users.UserID;


IF (CheckExists < 0) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Files does not exists';
ELSE
select files.Files,Users.firstname,Users.lastname,Users.EmailAddress from files,Users
where files.UserID = Users.UserID;
END IF;


END;


But when I execute the stored procedure I got an error message that says:

"SQL query:

CREATE PROCEDURE GetAllFiles()
BEGIN

DECLARE CheckExists int

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4"

Here's the link of the picture for more details:

https://www.dropbox.com/s/l2n2ge1ox2kzjwn/getallfiles%20procedure.jpg?dl=0

Options: ReplyQuote


Subject Views Written By Posted
Problem with stored procedures on phpmyadmin 2374 Andrew James 08/11/2016 03:20PM
Re: Problem with stored procedures on phpmyadmin 316 Peter Brawley 08/11/2016 06:41PM
Re: Problem with stored procedures on phpmyadmin 269 Andrew James 08/12/2016 12:07PM
Re: Problem with stored procedures on phpmyadmin 284 Peter Brawley 08/12/2016 12:31PM
Re: Problem with stored procedures on phpmyadmin 284 Andrew James 08/16/2016 02:37PM
Re: Problem with stored procedures on phpmyadmin 257 Peter Brawley 08/16/2016 02:52PM
Re: Problem with stored procedures on phpmyadmin 282 Andrew James 08/17/2016 11:23AM
Re: Problem with stored procedures on phpmyadmin 266 Peter Brawley 08/17/2016 12:17PM
Re: Problem with stored procedures on phpmyadmin 278 Andrew James 08/17/2016 02:35PM
Re: Problem with stored procedures on phpmyadmin 274 Peter Brawley 08/17/2016 04:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.