我使用的是mysql事务。如果首字母
where myHistoryNum
结果(匹配名称+行活动)不为空,然后继续事务。
我尝试过各种组合,但都不能得到正确的答案 insert
要在何时触发的语句 myHistoryNum
已设置。
history | uuid | name | rowActive
24 | abcd | Art | 1 <<< is match, trigger an insert
999 | zxcv | Art | 0 <<< no match, do not trigger insert
start transaction;
select @myHistNum := max(history), @olduuid := uuid
from mytable WHERE (name=art AND rowActive=1);
# START IS NOT NULL test
CASE WHEN @myHistNum IS NOT NULL THEN
set @histNum = @histNum + 1;
INSERT INTO mytable
.....
END; <<<ALT, tried END AS;
commit;
也试过了
IF @myHistNum IS NOT NULL
THEN
.....
END IF;
commit;
1条答案
按热度按时间rta7y2nd1#
如果我没弄错的话,控制流语句(比如if,when)只能在mysql的存储程序中使用