I have got a problem. I have java program which calls a oracle stored procedure and it works fine if output is single row. We can use cursor in procedures to display output on SQL> but this does not work for Java program.

In Java program I am using PrepareCall() to execute the stored procedure but the output is still single row where as I am expecting the multiple row output. This may be happening becaues the cursor variables in stored procedures keep only last row values.

What I want is my stored procedure returns a output which can be stored into the resultset in java. Do I have to use Types for this.

If anyone can give me a simple program in stored procedure (e.g. even on SCOTT user EMP table like 'SELECT EMPNO, ENAME FROM EMP' which will return result set that can be stored into the java resultset)
I ll be very much thankful.

create or replace procedure jdbc_3 (var1 out number,var2 out varchar2) is
cursor c1 is select empno, ename from emp;
for c2 in c1 loop
end loop;

The above procedure called from java just invokes last record's empno and name. Can anyone help me out in this regard