开发者

mysql IF statement problem

I have this UDF

CREATE FUNCTION merge(user_id INT) RETURNS TEXT
BEGIN
DECLARE dsc TEXT;
     IF user_id = 1
      --some SQL statements
      END IF;
    RETURN dsc;
END//

For some reason even if the value开发者_运维技巧 of user_id is != 1 --some SQL statements are executed. Any ideas ?


CREATE FUNCTION merge(_USER_ID INT) 
RETURNS TEXT DETERMINISTIC READS SQL DATA
BEGIN
DECLARE _DSC TEXT;
     IF _USER_ID = 1 THEN
      --some SQL statements
     END IF;
    RETURN (_DSC);
END//
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜