I think I figured out what the problem is.
I wasn't not putting cursorName in quotes, like so:
rs = ps.executeQuery("fetch all from \"" + cursorName + "\"");
Thanks anyhow.
Regards,
Stuart
On Tue, 2 Jul 2002, Stuart
Robinson wrote:
> I'm trying to use a function that returns a refcursor in a web
> application.
>
> I followed the example code I found at this URL (as suggested on this
> mailing list):
>
> http://fts.postgresql.org/db/mw/msg.html?mid=1354157.
>
> I wound up writing this code inside of my base factory class:
>
> System.out.println("-- SQL: " + stmt);
> ps = con.prepareStatement(stmt);
> ps = bindSelectStmt(ps, obj, selectCase);
> ResultSet rs = ps.executeQuery();
> rs.next();
> String cursorName = rs.getString(1);
> System.out.println("-- CURSOR NAME: " + cursorName);
> rs = ps.executeQuery("fetch all from " + cursorName);
>
> But when I try running that, I get the following output from
> Tomcat:
>
> -- SQL: SELECT get_examples_by_entry_id(?)
> -- CURSOR NAME: <unnamed cursor 1>
> java.sql.SQLException: ERROR: parser: parse error at or near "<"
>
> I believe the exception is caused by the cursor name, which I know from
> the system-out to be:
>
> <unnamed cursor 1>
>
> Any ideas as to what's going on here?
>
> Thanks in advance.
>
> Regards,
> Stuart
>
>
--
Stuart P. Robinson [stuart@zapata.org]
688 Hampshire Street
San Francisco, CA 94110
USA