Re: CallableStatement: java.sql.Types=12 however type - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: CallableStatement: java.sql.Types=12 however type
Date
Msg-id Pine.BSO.4.56.0412221509260.1747@leary.csoft.net
Whole thread Raw
In response to Re: CallableStatement: java.sql.Types=12 however type java.sql.Types=1111  (Jerome Colombie <jcolombie@gmx.ch>)
List pgsql-jdbc

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 <type>.  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

pgsql-jdbc by date:

Previous
From: Jerome Colombie
Date:
Subject: Re: CallableStatement: java.sql.Types=12 however type java.sql.Types=1111
Next
From: Oliver Jowett
Date:
Subject: Re: [BUGS] BUG #1347: Bulk Import stopps after a while (