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;
the condition should be true and execute A part of code but always execute B part.
How to use select with if statement? Thank you very much.
尝试select id from votes where votes.question_id = question_id and votes.vote_type_id = 3 into vote_id;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.