X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 32F393ABE24 for ; Wed, 22 Dec 2004 20:14:44 +0000 (GMT) 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 21162-04 for ; Wed, 22 Dec 2004 20:14:20 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id A09D93ABCA6 for ; Wed, 22 Dec 2004 20:14:18 +0000 (GMT) Received: (qmail 23315 invoked by uid 1112); 22 Dec 2004 20:16:07 -0000 Date: Wed, 22 Dec 2004 15:16:06 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Jerome Colombie Cc: pgsql-jdbc@postgresql.org Subject: Re: CallableStatement: java.sql.Types=12 however type In-Reply-To: <41C9BF5D.9020809@gmx.ch> Message-ID: References: <41C8934F.9060403@gmx.ch> <41C9BF5D.9020809@gmx.ch> 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.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/168 X-Sequence-Number: 11834 On Wed, 22 Dec 2004, Jerome Colombie wrote: > Thanks you very much for your help. It works perfectly now. I just > wonder why it didn't work with the callable statement. In my opinion it > should also work with the procedure call, since it is a stored > procedure. Postgresql doesn't really support stored procedures, only functions. In time this function support was hacked to return sets, but it is not really true stored procedure support. Notably from the caller's perspective how can you tell what the difference is between a function that returns an int and a function that returns a setof int, but returns only one row. In both cases you get a one row, one column result. In the first case CallableStatement.getObject should return Integer, but in the second case you're suggesting it should return ResultSet. I'm unclear on how to make this determination in the client. > works perfectly, but according to an O'Reilly Article > (http://www.onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html?page=last) > the callable statement should also work, but maybe this is obsolete now. > This examples shows returning a refcursor, not a setof . This does work, and is different because a refcursor is a single scalar value (a cursor name) that may then be transformed into a true ResultSet. Kris Jurka