Hi,

I am using the DBI with DBD::Pg (postgres) and would like to know how to
return the value of a unique index as a new row is inserted. I read through
the DBI manual and searched on the site, but without success.

Something like

my $dbh = DBI->connect(xxx);
my $sth = $dbh->prepare(insert into table (col) values ("col")
  || die $m->out("Could not prepare:" . $dbh->errstr);
$sth->execute() || $m->out("Could not execute:" . $dbh->errstr);
$dbh->commit() || die $m->out("Could not commit: " . $dbh->errstr);
???? What to do?
$sth->finish();
$dbh->disconnect();

The table is
+-----+-----+
|Idx  | col |
+-----+-----+
|     |     |
+-----+-----+
Where idx is automatically generated by a sequence.
I need the value of idx to manipulate further via Perl

Thank you
Tielman J de Villiers
BondNet Pty Ltd

Reply via email to