Actually there is no danger with my method for two reasons. 1. The insert and the select to retrieve the CurrVal should be included in a single CFTRANSACTION. 2. The ONLY user of the database is the Coldfusion server which is logged into Oracle. The CurrVal function returns the last sequence number used by that specific user logged into Oracle. It does not matter how many other users may have used the CurrVal function on a sequence. CurrVal will only return the last number YOU userid generated.
----- Original Message ----- From: "Deanna Schneider" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, June 26, 2002 4:53 PM Subject: Re: getting auto id > Wally's method can be a little dangerous, as several people could hit the > same sequence simultaneously and you could end up returning the wrong id. I > prefer to do it the other way around - return the next available sequence > number, then use it in the insert. > > <cfquery name="getnew"....> > SELECT schemaname.sequencename.nextval AS newid > FROM dual > </cfquery> > > <cfquery...> > INSERT INTO schemaname.tablename(IDColumn, Column2) > VALUES (#getnew.newid#, 'mydata') > </cfquery> > > -d > > > Deanna Schneider > Interactive Media Developer > [EMAIL PROTECTED] > > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

