Cursor Types in Procedures

Cursor Types in Procedures

If we want to use CURSOR types in Stored Procedures in order to retrieve multiple Records data then we have to use the following method on

// SimpleJdbcCall reference.
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(dataSource);
jdbcCall = jdbcCall.withProcedureName("getAllEmployees");
jdbcCall = jdbcCall.returningResultSet("emps",BeanPropertyRowMapper.newInstance(Employee.class));

After adding returningResultSet(–,–) method, if we access execute() method on SimpleJdbcCall then execute() method will execute procedure, it will get all the results from CURSOR type variable and stored all records in the form of Employee objects in an ArrayList object with “emps”[CURSOR TYPE variable] key in a Map.

Cursor Types in Procedures


Scroll to top