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语句选择?非常感谢你。
答案 0 :(得分:1)
尝试select id from votes where votes.question_id = question_id and votes.vote_type_id = 3 into vote_id;