On Apr 11, 8:43 pm, nace...@[EMAIL PROTECTED]
("Nacef LABIDI") wrote:
> Nice idea but how can I use this in a frontend that I am developing
using
> Delphi and ADO objects ?
>
> On Fri, Apr 11, 2008 at 7:41 PM, Scott Marlowe <scott.marl...@[EMAIL PROTECTED]
>
> wrote:
>
> > On Fri, Apr 11, 2008 at 11:23 AM, Nacef LABIDI <nace...@[EMAIL PROTECTED]
>
wrote:
> > > Hi all,
>
> > > I was wondering if postgres can return the last ID inserted for a
table
> > > which the primary key is autoincremented. I need to retrieve this ID
in
> > my
> > > code to continue processing on that inserted row.
>
> > smarlowe=# create table test (a serial primary key, b text);
> > NOTICE: CREATE TABLE will create implicit sequence "test_a_seq" for
> > serial column "test.a"
> > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
> > "test_pkey" for table "test"
> > CREATE TABLE
> > smarlowe=# insert into test (a,b) values (DEFAULT,'test') returning a;
> > a
> > ---
> > 1
> > (1 row)
>
> > INSERT 0 1
>
> > Note that there are other ways of doing it, but I really like the
> > returning clause.
for delphi (especially for 2006) you can use postgreDAC component (not
free but their technical sup****t is very good)... or ZeosLib (free and
opensource -is the best ^^) (http://sourceforge.net/projects/zeoslib)
as far as i know, for the main question... you can write a component
inheriting query object for solving the issue...
(sahapasci@[EMAIL PROTECTED]
)


|