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