开发者

Mysql syntax error (mysql noob here) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 9 years ago.

Improve this question
DELIMITER ||

CR开发者_StackOverflowEATE 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

Note
Specifying a parameter as IN, OUT, or INOUT is valid only for a PROCEDURE. 
For a FUNCTION, parameters are always regarded as IN parameters.

Therefore, I believe you should drop the IN.

Try:

CREATE FUNCTION InsertEvent (iPatientMonitoringId BIGINT, iTypeId SMALLINT(6), 
iChannelId SMALLINT(6), iStart TIMESTAMP, iEnd TIMESTAMP) RETURNS BIGINT 
DETERMINISTIC
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜