On 14 May 2001, at 15:00, JACOB PETRIE wrote:

> I am new at using DBI.  I would like to have a form that order data
> can be entered in, and when submitted the user will be given a
> reference number from the database.  The reference number is set-up as
> a sequence in the PostgreSQL database.  How can I pull this field
> after the data is submitted?
> 
> Any help would greatly be appreciated.

My method is to create that number before the data is submitted 
(which wastes numbers but then I don't do an if exists update 
rather than update ... all update). I do that as such:

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

More info here (use of serial etc)

http://www.postgresql.org/idocs/index.php?datatype.html
http://www.postgresql.org/idocs/index.php?sql-createsequence.html

Peter
"We must respect the other fellow's religion, but only in the same sense
and to the extent that we respect his theory that his wife is beautiful
and his children smart." -- H. L. Mencken

Reply via email to