There's also the issue of other people. I know which sequence to use -
but the person to whom I give the code might not bother to read the
pages of docs over which I laboured (*cough*). I can also allow other
schema to access my tables via the SP without having to give them any
access to the table at all - I just give them execute access to the SP
(which uses a trigger, simplifying the whole thing for everyone). I'm
working on a project right now wherein I wish I'd used triggers for all
my inserts (and other SQL), since another schema needs access to my
tables without them. A rewrite is in order.

-----Original Message-----
From: RADEMAKERS Tanguy [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 7 June 2005 10:18 
To: CF-Talk
Subject: RE: Get New Record ID in ORACLE

>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>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208798
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to