title: SELECT multiple rows and columns into a record variable
body: <p>In a plpgsql function, how can multiple rows and columns be selected into a record variable?</p>
  
  <p>For example, I would like to <code>SELECT</code> multiple instances of two columns (<code>yearinteger</code> and <code>value</code>) into a record variable (<code>yearvalues</code>).</p>
  
  <p>*EDIT - the following code is just part of a longer function, I need the variable <code>yearvalues</code> to contain multiple rows and columns from a table from which I can create further variables from</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fn_function ()
  RETURNS TABLE () AS $$
  DECLARE
      year c.year%TYPE;
      value c.value%TYPE;
      yearvalues record;
  BEGIN
      FOR yearvalues IN 
      SELECT c.year, c.value FROM c
      LOOP
      END LOOP;
  -- creation of additional variables from the yearvalues variable
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>