MySQL Forums
Forum List  »  Stored Procedures

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
Re: Problem with stored procedures on phpmyadmin
961
August 16, 2016 02:37PM


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.