title: Using variables in a postgres sql block
body: <p>Can you have an SQL block  that accepts a variable  for input, uses that variable in a join and returns a result set. </p>
  
  <p>The kicker is that I have been asked to do this outside a function - i.e. within an SQL block. </p>
  
  <p>So, for example, I want to pass the value <code>1234567890</code> to the variable <code>v_hold</code>:</p>
  
  <pre><code>DO $$
  declare
     v_hold integer;
  BEGIN
  
   select * from t_table_A where ID = v_hold ; 
  --return alert_mesg;
  END$$;
  --$$ LANGUAGE plpgsql
  </code></pre>
  
  <p>The testing I've done says that in order to return a result set, you have to define that in a <code>RETURN TABLE</code> declaration. I've tried to define this outside a function, but I haven't figured it out.</p>
  
  <p>Can this be done outside a function - i.e pass a variable and return a result set based on a select statement which references a variable in the where clause?</p>