1
DECLARE vote_id INT;
select id from votes where votes.question_id = question_id and vote_type_id = 3 into vote_id;
if vote_id is null then
...do A
else
...do B
end if;
该条件应该是true并执行一部分代码但总是执行B部分。
如何使用选择与if语句?非常感谢你。MySQL存储过程if语句
也许'vote_id'永远不会为您的查询为空? – adarshr 2011-12-28 09:35:23
我在mysql中执行'select id ...'并返回id – VvDPzZ 2011-12-28 09:39:27