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.
vote_idis never null as per your query?