HI

I have gone thru the above link and it worked but there were no in parameters were passed. I therefore modified the function following way


create or replace function sp_ListEmp(eno in number) return types.cursortype
as
l_cursor types.cursorType;
begin
open l_cursor for select ename, empno from emp
where empno > = eno
order by ename;
return l_cursor;
end;
/

Now If I want to Call this from Java program I have to add question mark in function parameter and Set the parameter

class curvar
{
public static void main (String args [])
throws SQLException, ClassNotFoundException
{
String driver_class = "oracle.jdbc.driver.OracleDriver";
String connect_string = "jdbcracle:thin:@slackdog:1521racle8";
int num1 = Interger.parseInt(argv[0]);
String query = "begin :1 := sp_listEmp(?); end;";
Connection conn;
Class.forName(driver_class);
conn = DriverManager.getConnection(connect_string, "scott", "tiger");

CallableStatement cstmt = conn.prepareCall(query);
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
cstmt.setInt(1, num1)
cstmt.execute();
ResultSet rset = (ResultSet)cstmt.getObject(1);

while (rset.next ())
System.out.println( rset.getString (1) );
cstmt.close();
}
}

The Code written above is not working .Can you let me know the solution on how to call a parameterized function on Java Platform

Amol