Thread: Re: [SQL] Is this possible?

Re: [SQL] Is this possible?

From
"Peter J. Schoenster"
Date:
On 11 May 2001, at 11:24, Roberto Mello wrote:

> On Tue, May 08, 2001 at 09:16:56PM -0400, Wei Weng wrote:
> > I have a table that has a serial for primary key. Is it possible to
> > get the new available primary key right after I insert a row of new
> > entry?
>
>  Yeah. Se the documentation on triggers.

My method is to insert into the target table(s) in advance.

my ($job_id) = $self->{dbh}->selectrow_array(qq|SELECT
NEXTVAL ('zipinfo_job_id_seq')|);

and then I use job_id as a hidden value in the form that gets printed.

Peter



---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
                -- Philip K. Dick