hi,
Hope this example helps you.
/*
* This sample shows how to call a PL/SQL procedure that opens
* a cursor and get the cursor back as a Java ResultSet.
*/
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
class RefCursorExample
{
public static void main (String args [])
throws SQLException
{
// Load the driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
// You can put a database name after the @ sign in the connection URL.
Connection conn =
DriverManager.getConnection ("jdbc

racle

ci8

", "scott", "tiger"

;
// Create the stored procedure
init (conn);
// Prepare a PL/SQL call
CallableStatement call =
conn.prepareCall ("{call java_refcursor.job_listing (?,?)}"

;
// Find out all the SALES person
call.registerOutParameter (1, OracleTypes.CURSOR);
call.setString (2, "SALESMAN"

;
call.execute ();
ResultSet rset = (ResultSet)call.getObject (1);
// Dump the cursor
while (rset.next ())
System.out.println (rset.getString ("ENAME"

);
// Close all the resources
rset.close();
call.close();
conn.close();
}
// Utility function to create the stored procedure
static void init (Connection conn)
throws SQLException
{
Statement stmt = conn.createStatement ();
stmt.execute ("create or replace package java_refcursor as " +
" type refcurtype is ref cursor return EMP%ROWTYPE; " +
" procedure job_listing (a_rc in out refcurtype,a_job in varchar2) ; " +
"end java_refcursor;"

;
stmt.execute ("create or replace package body java_refcursor as " +
" procedure job_listing (a_rc in out refcurtype, a_job in varchar2) is " +
" v_rc refcurtype; " +
" begin " +
" open a_rc for select * from emp where job = a_job; " +
" end; " +
"end java_refcursor;"

;
stmt.close();
}
}
regards,
VGG