title: How to return a table of values from a function in oracle
body: <p>I have tried some of the answers and could not make my code work:
  Here is what I want and here is what I did:
  I have a table which is two column type and I want to query that table using a function to return exactly the same table to be routed to VB.NET so that I can display it in a DatagridView control.
  I am a novice to PL/SQL which is the problem for me.
  The first problem I intended to solve is to create the function.</p>
  
  <pre><code>-- DECLARE A RECORD TYPE
  create or replace type shipper_type AS OBJECT
  (
  shipper_id number,  shipper_name varchar2(7)
  );
  /
  
  CREATE TYPE t_shipper as table of shipper_type;
  /
  
      create or replace function get_shipper return t_shipper is 
      temp_list t_shipper:= t_shipper();
      is  
       --  shipper_record shipper_type;
      begin
        for i in (  (select shipper.shipper_id, shipper.shipper_name) list from shipper) 
        loop
          temp_list.extend;
        temp_list(temp_list.last):= t_shipper(list);   
      end loop;
  
      return(temp_list);
     end get_shipper;
     /
  </code></pre>
  
  <p>When I try to compile this code I am getting the following errors:
  Errors for FUNCTION GET_SHIPPER:</p>
  
  <pre><code>LINE/COL ERROR
  -------- -----------------------------------------------------------------
  3/1      PLS-00103: Encountered the symbol "IS" when expecting one of the
           following:
           begin function pragma procedure subtype type &lt;an identifier&gt;
           &lt;a double-quoted delimited-identifier&gt; current cursor delete
           exists prior
  
  6/63     PLS-00103: Encountered the symbol ")" when expecting one of the
           following:
           . ( , * @ % &amp; - + / at mod remainder rem &lt;an identifier&gt;
           &lt;a double-quoted delimited-identifier&gt; &lt;an exponent (**)&gt; as
           from || multiset
  </code></pre>