ResultSet rs = null;
CallableStatement stmt = null;
List<TestObj> objList= new ArrayList<TestObj>();
try
{
stmt = con.prepareCall( "{? = call TEST_FUNCTION(?,?) }");
stmt.registerOutParameter( 1, Types.VARCHAR );
stmt.setString( 2, "A");
stmt.setString( 3, "B");
stmt.execute();
rs = stmt.getResultSet();
while( rs.next() )
{
TestObj obj= new TestObj ();
obj.setA( rs.getString( "TEST1" ) );
obj.setB( rs.getString( "TEST2" ) );
obj.setC( rs.getString( "TEST3" ) );
obj.setD( rs.getString( "TEST4" ) );
objList.add( obj);
}
}
catch( SQLException e )
{
e.printStackTrace();
}
finally
{
rs.close();
stmt.close();
}
When run, it gives me a null point exception at 'rs.next()'. Can anyone please tell me how to access the return values from the function.
Note : Passing values to the function and executing the query works fine without any exceptions ( stmt.execute() run without any exceptions )