X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E16E5E4993 for ; Sat, 4 Sep 2004 18:33:06 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68157-09 for ; Sat, 4 Sep 2004 17:33:04 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id A8A025E4B51 for ; Sat, 4 Sep 2004 18:31:49 +0100 (BST) Received: from web51806.mail.yahoo.com (web51806.mail.yahoo.com [206.190.38.237]) by svr4.postgresql.org (Postfix) with SMTP id F24D35AFD4A for ; Sat, 4 Sep 2004 16:39:11 +0000 (GMT) Message-ID: <20040904160747.66889.qmail@web51806.mail.yahoo.com> Received: from [200.69.139.213] by web51806.mail.yahoo.com via HTTP; Sat, 04 Sep 2004 09:07:47 PDT Date: Sat, 4 Sep 2004 09:07:47 -0700 (PDT) From: Leo Martin Orfei Subject: problems returning a resultset from a function To: pgsql-general@postgresql.org Cc: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/494 X-Sequence-Number: 65700 hi. I have a problem with postgres functions. I need return a resultset from a postgres function and browse the resultset in a java app. I try with this simple function: create function test() returns catalog.refcursor as' declare aux refcursor; BEGIN OPEN aux FOR SELECT name, address FROM table; RETURN aux; END; 'LANGUAGE 'plpgsql'; and the java CallableStatement cs = null; ResultSet rs = null; cs = con.prepareCall("{ ? = call test()}"); cs.registerOutParameter(1, java.sql.Types.OTHER); rs = cs.executeQuery(); rs.next(); System.out.println("name: " +rs.getString(1)); but throws te following error: cursor "" does not exist I try this too: Statement s = null; rs = s.executeQuery("select test()"); rs.next(); System.out.println("name: " +rs.getString(1)); and don't throws an error, but show me the following result: name: anybody can help me with this? thnx; __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail