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

Re: CallableStatement problem...?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Dave Minter <dave(at)paperstack(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: CallableStatement problem...?
Date: 2005-04-29 08:44:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Tue, 26 Apr 2005, Dave Minter wrote:

> I'm puzzled. I'm trying to invoke a PG/plSQL function as a callable
> statement. The function takes one parameter, inserts it into a table,
> and returns. Since I'm not selecting anything and I have no (or rather,
> only a void) return parameter, I expected to be able to call
> executeUpdate() on the CS to have this take effect - but I get this
> error message:
> org.postgresql.util.PSQLException:
> A result was returned when none was expected.
> If I call executeQuery, then it works perfectly (but that causes
> problems with a 3rd party tool I'm using which expects a pure-insertion
> sproc to be comfortable with a call to executeUpdate).

This is how the driver works, it replaces {call myfunc()} with SELECT * 
FROM myfunc, which will always return a ResultSet.  It seems we could 
special case CallableStatements version to expect and ignore a result when 
executeUpdate is called.

Kris Jurka

In response to

pgsql-jdbc by date

Next:From: Antony PaulDate: 2005-04-29 09:46:32
Subject: Re: Impact of open ResultSets and PreparedStatements ?
Previous:From: Kris JurkaDate: 2005-04-29 08:04:34
Subject: Re: Impact of open ResultSets and PreparedStatements ?

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