| From: | "Chinthaka Kariyawasam" <chinthaka(at)codegen(dot)net> |
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | fetch from cursor |
| Date: | 2003-06-12 09:52:28 |
| Message-ID: | 3EE84D5C.000005.00956@chinthaka2k |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martijn van Oosterhout | 2003-06-12 09:59:15 | Re: Performance question.. |
| Previous Message | mogas | 2003-06-12 09:16:13 |