[Dbix-class] last insert id problem with Oracle

Anthony Lincoln ahlincoln at lbl.gov
Sat Jul 8 00:03:18 CEST 2006


Matt S Trout wrote:
> Anthony Lincoln wrote:
> 
>>Having a little trouble grabbing the autoincremented primary key from a 
>>row after its successful insertion.
>>
>>if I do:
>>
>>	    undef $id;
>>             my $change = $model->update_or_create({
>>                 id => "$id",
>>             },{ key => 'primary' }
>>             );
>>
>>Shouldn't I just be able to refer to the newly incremented id via 
>>$change->id?  I've tried $change->update again, and $change->reset, but 
>>I can't get hold of this id until I do a separate select.
> 
> 
> "$id" is going to pass the empty string. Get rid of the quotes.

Nope, no luck.  Autoincrement works fine with/without quoted $id, but I 
still get left with no $change->id.  I just upgraded to DBI 1.51, so I'm 
pretty sure it's not a version issue.



More information about the Dbix-class mailing list