Is there a way in to just run a query once to select into a variable, considering that the query might return nothing, then in that case the variable should be null.
COALESCE will always return the first non-null result. By doing this, you will get the count that you want or 0:
COALESCE
select coalesce(count(column) ,0) into v_counter from my_table where ...;