How to store single result in variable and reuse it in a query (Oracle)?
For Toad, from this answer on SO:


  I think this will accomplish what you want.  You can declare a bind variable, insert a value into it, and then use it in future statements.

variable l_var varchar2(1);

begin
  select dummy
    into :l_var
    from dual;
end; 

select *
from dual
where dummy = :l_var;