I would avoid using a trigger by selecting the next sequence value as part of your Insert statement (assuming you don't need to know what it is). So if you have a sequence s_foo then:
Insert into foo select s_foo.nextval,value1,value2... From dual Andy > -----Original Message----- > From: Peter J. Holzer [mailto:[EMAIL PROTECTED] > Sent: 16 June 2004 14:04 > To: [EMAIL PROTECTED] > Subject: Re: Best Way to Auto Increment with Oracle > > On 2004-06-16 05:21:07 -0700, Jim wrote: > > I am looking for suggestions on the best way to auto > increment a key > > column in a oracle table. I know I can do this inside of Oracle by > > creating a sequence and then a trigger. BUT, is it better > to make DBI > > do this when I insert the data? > > I guess that's a matter of taste. > > > If so, how would I go about > > $dbh->do("insert into foo(id, ...) values(foo_id_seq.nextval, ....)"); > > hp > > -- > _ | Peter J. Holzer | Shooting the users in the foot is bad. > |_|_) | Sysadmin WSR / LUGA | Giving them a gun isn't. > | | | [EMAIL PROTECTED] | -- Gordon Schumacher, > __/ | http://www.hjp.at/ | mozilla bug #84128 > __________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. The contents are confidential and may be privileged. Any views or opinions expressed are those of the sender and may not reflect the views or opinions of the company and the company accepts no liability in respect thereof. If you have received this email in error please notify [EMAIL PROTECTED] immediately. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________