fetch from cursor - Mailing list pgsql-general

From Chinthaka Kariyawasam
Subject fetch from cursor
Date
Msg-id 3EE84D5C.000005.00956@chinthaka2k
Whole thread Raw
List pgsql-general
I wrote a function in pl/pgsql which returns a cursor. I want to know how to fetch results from the cursor on the application using jdbc2.
following codes work but does not match to my case.
 
1. Statement stmt = con.createStatement(); // con is the sql connection
2. stmt.execute("BEGIN");   
3. int res = stmt.executeUpdate( "DECLARE test CURSOR FOR SELECT * FROM fare WHERE adult_value > 100.0" );
4. ResultSet rset = stmt.executeQuery( "FETCH FORWARD 10 IN test" );
 
here I just need to get the result from my function loadHighFares() instead of the SELECT statement in cursor declaration in line 3.
something like,
3. int res = stmt.executeUpdate( "DECLARE test CURSOR FOR SELECT loadHighFares()" );
 
but it does not work.
please can anyone help on this?
thanks and regards,
chinthaka
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here
Attachment

pgsql-general by date:

Previous
From: "Ivar"
Date:
Subject: Is it bug ?
Next
From: David Wheeler
Date:
Subject: ANNOUNCE: Bricolage 1.6.1