title: Fetching the results of sys_Refcurson in Java
body: <p>I have a function which uses sys_Refcursor</p>
  
  <pre><code>create or replace function get_employee
    (p_loc in number)
    return sys_refcursor
  as  
   l_rc sys_refcursor;
  begin
    open l_rc
     for select a.first_name, a.last_name, b.department_name 
       from employees a, 
            departments b 
      where a.department_id=b.department_id 
        and location_id=p_loc;
  
   return l_rc; 
  end;
  </code></pre>
  
  <p>and running this in SQL developer</p>
  
  <pre><code>select (get_employee(5)) from dual;
  </code></pre>
  
  <p>In Java I used </p>
  
  <pre><code>strSql+="select (get_employee(5)) from dual";
  
          resultSet = selectStatement.executeQuery(strSql);
  
  
          while (resultSet.next()) {
  
  
  
              System.out.println("here is the " + resultSet.getString(1) );
              System.out.println("here is the " + resultSet.getString(2) );
  
  
          }
  </code></pre>
  
  <p>But the above code is returning the resultset as Null. </p>
  
  <p>Could you please tell me the ways we can retrieve the result values of that function in Java?</p>
  
  <p>Thanks in Advance</p>