According to the DBD::Pg docs,

$sth->pg_oid_status 
    Returns the OID of the last INSERT command. 

See: http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-Pg/dbd-pg.html 


Thanks,
 
Tim Tompkins
----------------------------------------------
Programmer / Staff Engineer
http://www.arttoday.com/  
---------------------------------------------- 
----- Original Message ----- 
From: "cbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 07, 2000 1:28 PM
Subject: Retrieve OID from newly added record


> Hello everyone, does anyone know how to retrieve the Object Identifier
> (OID) from a record that was just inserted into a postgres database from
> within perl?
> 
> These are the commands I'm using to insert the record:
> 
> $sth = $dbh->prepare("Insert into inventory Values ($id)");
> $rc = $sth->execute;
> 
> $rc will tell me whether or not the insert was successful or not, but
> that's it.
> 
> If I insert records from the psql utility, the OID is returned on the
> screen after the insert, so I know it's there.  I just need to know how
> to get it from within modperl.  I want to get this number so I can
> insert a bunch of records in another file using the OID as the key.
> 
> Thanks in advance!!!!!
> 
> 

Reply via email to