You can also switch the order of your queries in Oracle, so first you Select myseq.nextval as newid from dual
Then you INSERT into mytable(myid) values(newid) On 6/6/05, James Holmes <[EMAIL PROTECTED]> wrote: > If you don't mind supplying the DB with a key, that would work. > > This convo has prompetd me to realise that I'm still using a transaction > with select max() in Oracle via the default transaction behaviour (i.e > not serializable) and there is a small chance, as Jochem said, that this > could give an erroneous result. > > It seems that in Oracle the best thing to do, when getting a value from > a trigger that selects from a sequence, would be to use something like > this: > > declare > i number; > begin > insert into sometable (something) > values (9) returning someid into i; > > Any other ideas for Oracle? > > -----Original Message----- > From: Calvin Ward [mailto:[EMAIL PROTECTED] > Sent: Monday, 6 June 2005 5:03 > To: CF-Talk > Subject: RE: Get New Record ID in mySQL > > How about using a UUID for the primary key and then you wouldn't have to > do the select? > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208654 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54