Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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 
> ( 
> 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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group