执行Insert into语句后,ROW_COUNT()
始终返回-1
。但是当我设置variable = ROW_COUNT()
时,变量等于0
。为什么呢?
block0: BEGIN
DECLARE contentid INT UNSIGNED;
DECLARE remarkid INT UNSIGNED;
**INSERT INTO richtext_base
VALUES(NULL, "richtext", in_uid, in_content); /** Here is the insert into statement **/
IF (ROW_COUNT())=-1 THEN /** ROW_COUNT() always returns -1, so as those below**/**
SET out_eid = 152;
LEAVE block0;
ELSE
SET contentid = (SELECT LAST_INSERT_ID());
END IF;
END block0;