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//
精彩评论