title: How can I create and return a cursor from a plsql function?
body: <p>I created a plsql function and I want to create a cursor and return this cursor from the function. Then I want to call this function in a Java class and retrieve data from the cursor. Note: the cursor returns one row.
  I wrote something like this,,</p>
  
  <pre><code>CREATE OR REPLACE
  FUNCTION FUNCTION1 ( emp_id IN NUMBER)RETURN cursor AS
  
    cursor newCursor(e_id number) is  
      select * from table1 where employee_id = e_id;        
      type refCursor is ref cursor;
  
    BEGIN
  
    open newCursor(emp_id);    
    loop
    exit when newCursor%notfound;   
      fetch newCursor into refCursor;  
    end loop;
    RETURN refCursor;
  
  END FUNCTION1;
  </code></pre>
  
  <p>What return type should I use if I want to return a cursor?</p>