DELIMITER ||
CREATE FUNCTION InsertEvent (IN iPatientMonitoringId BIGINT,
IN iTypeId SMALLINT(6),
IN iChannelId SMALLINT(6),
IN iStart TIMESTAMP,
IN iEnd TIMESTAMP)
RETURNS BIGINT DETERMINISTIC
BEGIN
INSERT INTO Event
(Id, PatientMonitoringId, TypeId, ChannelId, StartOcurrence, EndOcurrence)
VALUES
('', iPatientMonitoringId, iTypeId, iChannelId, iStart, iEnd);
RETURN LAST_INSERT_ID();
END ||
DELIMITER ;
This sql query looks ok to me but I’m not understanding the error returned by phpmyadmin:
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 ‘IN iPatientMonitoringId BIGINT, IN
From: http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
Therefore, I believe you should drop the IN.
Try: