Обсуждение: fetch from cursor

Поиск
Список
Период
Сортировка

fetch from cursor

От
"Chinthaka Kariyawasam"
Дата:
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
Вложения