title: Returning multiple rows with a function
body: <p>While calling the function below, i get only the last row of all the rows that is returned by the cursor. It is important that I use cursor in this statement.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fnc_get_contractor_id(cst_username IN VARCHAR2 )
      RETURN NUMBER
      AS
  
      CURSOR cursor_contract_name IS
      SELECT plc.FK2_CONTRACTOR_ID
          FROM lds_consultant cons
          INNER JOIN lds_account acc on cons.consultant_id = acc.fk1_consultant_id 
          INNER JOIN lds_placement plc on acc.account_id = plc.FK1_ACCOUNT_ID
          WHERE UPPER(cons.USERNAME) = UPPER(cst_username)
          AND UPPER(plc.PLT_TO_PERMANENT) = UPPER('Y');
  
      V_contracotr_id number(10);
  
      BEGIN
  
      for rec in cursor_contract_name loop
  
        V_contracotr_id := rec.fk2_contractor_id;
  
        dbms_output.put_line('cst_username : '||cst_username||'  V_contracotr_id :'||V_contracotr_id);
  
              --return V_contracotr_id;
  
              END LOOP;
  
                      return V_contracotr_id;
      END;
      /
  </code></pre>
  
  <p>how could i return all the rows so that i can create a table using the returned rows?</p>