I am receiving an error 1064 on the following stored procedure:
12 DELIMITER //
13 DROP PROCEDURE IF EXISTS add_python_photo;
14 CREATE PROCEDURE add_python_photo( IN fname VARCHAR,
15 IN fpath VARCHAR,
16 IN fdata LONGBLOB,
17 IN python INT,
18 IN is_preferred TINYINT,
19 OUT python_photo_id INT)
20 BEGIN
21 INSERT INTO python_photo ( file_name,
22 file_path,
23 file_data,
24 python_id,
25 preferred)
26 VALUES (fname,
27 fpath,
28 fdata,
29 python,
30 is_preferred);
31
32 SELECT LAST_INSERT_ID() INTO python_photo_id;
33 END//
34 DELIMITER ;
mysql> source stored_procedures/add-python-photo.sql
Query OK, 0 rows affected, 1 warning (0.00 sec)
ERROR 1064 (42000): 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 '
IN fpath VARCHAR,
IN fdata LONGBLOB,
IN python INT,
' at line 1
I'm uncertain as to what syntactic error MySQL is referring to. The list of 'IN' parameters appears to be syntactically correct - yet, that appears to be the source of the error. It seems to fail while processing the 'IN python_id INT' parameter.
UPDATE
Regarding the DELIMITER suggestion, below is another stored procedure - which executes correctly:
12 DELIMITER //
13 DROP PROCEDURE IF EXISTS add_python_parent;
14 CREATE PROCEDURE add_python_parent( IN python_id INT,
15 IN mother_id INT,
16 IN father_id INT)
17 BEGIN
18 INSERT INTO python_parent (python_id, mother_id, father_id)
19 VALUES (python_id, mother_id, father_id);
20 END//
21 DELIMITER ;
Execution:
mysql> source stored_procedures/add-python-parent.sql
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)