RE: jdbc how to get SERIAL

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: "'John Thorhauer'" <jthorhauer(at)phoenixcolor(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: RE: jdbc how to get SERIAL
Date: 2000-07-19 06:41:50
Message-ID: 1B3D5E532D18D311861A00600865478CF1B0F0@exchange1.nt.maidstone.gov.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

The function currval does this. Ie:

select currval("mycol_id_seq");

where mycol is the table and id is the column for the sequence.

Would return that value. PS: The result is for that session, so if another
session increments that sequence, you don't see that value but the last
value of _your_ session.

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council

-----Original Message-----
From: John Thorhauer [mailto:jthorhauer(at)phoenixcolor(dot)com]
Sent: Tuesday, July 18, 2000 7:37 PM
To: pgsql-interfaces(at)postgresql(dot)org
Subject: [INTERFACES] jdbc how to get SERIAL

How do I get the id column of a row via jdbc if the column is a SERIAL
column. I want to get the id of the row after I insert new data via
jdbc execute command.

Thanks,
John Thorhauer

--
********************************
** John Thorhauer
** jthorhauer(at)phoenixcolor(dot)com
********************************

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-07-19 06:47:13 RE: Connection.setBytes()
Previous Message Peter Mount 2000-07-19 06:36:28 RE: ResultSetMetaData problems (getColumnType() and -TypeName)