I'm a student and new to Java and stored procedure. I'm trying to write a stored procedure which is supposed to return a table row as java object.
I've this table: USER_TABLE(USERID, USERNAME, DOB)
& Procedure is :
create or replace procedure "USER_OUT" (USERID in varchar2,UserObj out User)
is
begin
select * from user_table where
USERID = UserObj.USERID;
end USER_OUT;
In Java I'm trying to call this procedure and retrieve the object as :-
CallableStatement callableStatement = dh.con.prepareCall("{call USER_OUT(?)}");
User usr = new User();
callableStatement .setInt (1,"123");
usr1 = (User)callableStatement.getResultSet();
callableStatement.registerOutParameter(1, OracleTypes.CURSOR);
callableStatement.executeUpdate();//getting exception as Object is invalid.
Is the procedure wrongly implemented or am I missing something ? Any help is really appreciated!! Thanks.