[Dbix-class] trouble with oracle sequence

Matt S Trout dbix-class at trout.me.uk
Thu May 24 23:49:19 GMT 2007


On Thu, May 24, 2007 at 02:50:47PM -0400, Rom Bre wrote:
> I'm getting the following error after attempting to insert into a table
> where i have setup an oracle sequence:
> 
> DBIx::Class::ResultSet::create(): Can't get last insert id
> 
> 
> This is happening because dbic is attempting to do a SELECT
> STORE_CART_SEQ.CURRVAL FROM DUAL, without a preceding NEXTVAL.
> 
> 
> Here's the create statement:
> 
> $c->model('StoreDB::Cart')->create({ session_id => $session_id });
> 
> 
> I'm under the assumption that the NEXTVAL will be handled
> automatically and that I don't need to specify anything in the create

PK::Auto expects you have a trigger that does the NEXTVAL and populates the
id during INSERT (ala e.g. postgres' SERIAL data type)

I think you might be looking for PK::Sequence

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list