Home » Java » Fetch result set from a postgres Stored procedure in java

Fetch result set from a postgres Stored procedure in java

Posted by: admin May 17, 2018 Leave a comment

Questions:

I created a postgres function which returns a set of ref cursors. When I call the stored procedure from java the JDBC statement build is

select * from ga_rpt_movement('CODE','2018-5-10','2018-5-10','2018-5-10','C','STAT1','2018-5-10','2018-5-10','12344','A','T','34',25,50,'M','1','firstname',0,10) as result

When I run the same query on postgres terminal it gives me the four coursors.
Now I am not able to understand how do I fetch this cursor data in java.
Any suggestions, ideas are welcome and appreciated.

Result set when I run this query on postgres terminal look like this :

p_cr_personstatus

p_cr_identification

p_cr_phone

p_cr_count

(4 rows)

I am trying to implement this using spring JPA only.

Answers: