Search code examples
mysqlstored-proceduresmysql-error-1064

Error creating stored procedure


Im trying to create this stored procedure:

CREATE PROCEDURE GetExif 
(
IN @album VARCHAR(50), 
IN @pic VARCHAR(50)
)
BEGIN

SELECT CAMERA, 
FSTOP, 
EXPOSURE, 
ISO, 
FOCALLENGHT, 
DATETAKEN, 
GPSLATH, 
GPSLONG
FROM EXIF
WHERE ALBUMNAME = @album 
AND PICTURENAME = @pic

END

I get this error

#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 '@album VARCHAR(50),  IN @pic VARCHAR(50) ) BEGIN

SELECT CAMERA,  FSTOP,  ' at line 3

The select works fine.

MySql Serverversion is 5.0.51a-log

After removing the @s im getting this error

#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 'END' at line 20 

Solution

  • Have you read the manual? The parameter names shouldn't have @ in front of them.