select mysequence.nextval into newid from dual You are using a sequence for your IDs, no?
DK On 6/7/05, RADEMAKERS Tanguy <[EMAIL PROTECTED]> wrote: > > >what problem? I use this > > > >select mysequence.nextval into newid from dual > > > >insert into foo (a,b,c,pk) values (A,B,C, newid) > > > >do whatever else you want with newid....carry on. > > Yes, but how do you retrieve the value of the just inserted id? I can't > get the "select ... into..." syntax to work in a cfquery, perhaps you > could post an example? > > If you don't need to get this value, then you can rewrite your query as: > > <cfquery ...> > insert into foo (a,b,c,pk) values (A,B,C, mysequence.nextval) > </cfquery> > > /t > > > >-----Original Message----- > >Subject: Get New Record ID in ORACLE > >From: Douglas Knudsen <[EMAIL PROTECTED]> > >Date: Tue, 7 Jun 2005 08:59:07 -0400 > >Thread: > >http://www.houseoffusion.com/cf_lists/index.cfm/method=messages > >&threadid=40571&forumid=4#208782 > > > >what problem? I use this > > > >select mysequence.nextval into newid from dual > > > >insert into foo (a,b,c,pk) values (A,B,C, newid) > > > >do whatever else you want with newid....carry on. > > > >I have yet to really understand the need for doing everything > >via SPs. They > >are only really faster in complex situations, no? Also, they seem to > >complicate the ease of CF's cfquery tag too and place extra > >burden on SCM, > >IMHO. > > > >DK > > > >On 6/7/05, James Holmes <[EMAIL PROTECTED]> wrote: > >> > >> For one they get around the problem of getting the last id > >inserted into > >> the table as per some of the discussion in the MySQL thread > >yesterday, > >> without needing to use serializable transactions. Procedures are also > >> often pre-compiled, so they may run faster, even the first > >time they are > >> executed, although on an insert this probably doesn't make much > >> difference. > >> > >> -----Original Message----- > >> From: Aaron Rouse [mailto:[EMAIL PROTECTED] > >> Sent: Tuesday, 7 June 2005 11:57 > >> To: CF-Talk > >> Subject: Re: Get New Record ID in ORACLE > >> > >> What type of advantages does an SP in oracle(or whatever) have over > >> queries for basic DB inserts? > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:208799 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

