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

Re: getGeneratedKeys()

From: "Marcus Andree S(dot) Magalhaes" <marcus(dot)magalhaes(at)vlinfo(dot)com(dot)br>
To: <henr-and(at)dsv(dot)su(dot)se>
Cc: <johnsw(at)wardbrook(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: getGeneratedKeys()
Date: 2003-12-30 23:28:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

I am too dumb or a simple currval() would be useful?
We solved this by sending two queries in JDBC. The first one inserts
a single record in the db. The other issues a currval on the desired
There was a posting a few weeks ago, describing a clever method,
issuing both queries on the same connection by using the ";" operator
to separate the queries.
hope this helps.

>> Can you do the insert using a function instead, and return the currval
>> on the underlying sequence?
>> John
> I'm not sure what you mean. A stored procedure?
> The good thing about getGeneratedKeys() is that you don't have to write
> DB-specific code.
> --
> Henrik
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?

In response to

pgsql-jdbc by date

Next:From: Paul ThomasDate: 2003-12-30 23:56:23
Subject: Re: getGeneratedKeys()
Previous:From: henr-andDate: 2003-12-30 23:18:47
Subject: Re: getGeneratedKeys()

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