In cases where I need to use the ID immediately, I use a separate query to grab the sequence value first
Select unique_repair_ticket_s.NEXTVAL as id >From dual (dual, if you don't already know, being a sort of "dummy" table that you use for this sort of thing) Then use the result of this query for your insert, e.g. Insert into table (ID,field1,field2) Values (#query.id#,etc....) This way you can be sure you have the correct id value and don't have to worry about the issues you mentioned. > -----Original Message----- > From: Daniel Kessler [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 05, 2006 2:01 PM > To: CF-Talk > Subject: locking, I think > > I have an oracle database and I set the ID of a database entry using: > unique_repair_ticket_s.NEXTVAL - which is basically a counter > > I then need to get that ID and send it to the user. Is the process > for this to then query the database for the last entry? If so, do I > surround it with a cftransaction or a cflock to inhibit others > writing to it until that query is complete so that the last number is > actually the number that I need? > > thank you. > > -- > > Daniel Kessler > > College of Health and Human Performance > University of Maryland > Suite 2387 Valley Drive > College Park, MD 20742-2611 > Phone: 301-405-2545 > http://hhp.umd.edu > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255695 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4