I have a problem with the stored procedure of getallfiles. When I execute that stored procedure, I got an error message that says:
"Error
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 3"
Here's my stored procedure
CREATE PROCEDURE GetAllFiles()
BEGIN
# declaring checkexists for if the files exists
DECLARE CheckExists int;
DECLARE specialty CONDITION FOR SQLSTATE '45000';
SET CheckExists = 0;
# checking to see how many files are there
SELECT COUNT(files.Files,Users.FirstName,Users.LastName,Users.EmailAddress) INTO CheckExists from
files,Users where files.UserID = Users.UserID;
# checking to see if the files exists
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;