Re: CallableStatement: java.sql.Types=12 however type

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jerome Colombie <jcolombie(at)gmx(dot)ch>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: CallableStatement: java.sql.Types=12 however type
Date: 2004-12-22 20:16:06
Message-ID: Pine.BSO.4.56.0412221509260.1747@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-12-22 20:27:32 Re: [BUGS] BUG #1347: Bulk Import stopps after a while (
Previous Message Kris Jurka 2004-12-22 19:38:28 Re: Bug in JDBC-Driver?