A stored procedure could return the new id to you but I haven't found them
to be the most efficient means to do simple inserts.  Other than stored
procedures you have a couple of options (or more, I'm sure) - the "old
access method" using <cftransaction> around the insert and subsequent select
max(id), or using a select sequence.nextval from dual.  If you use the
latter there is no reason to use a <cftransaction>.

Dan

-----Original Message-----
From: Deanna L. Schneider [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 15, 2000 1:45 PM
To: [EMAIL PROTECTED]
Subject: oracle trigger to return newid


Hi folks,
I'm sure this has been answered, but I couldn't find it in the archives.

Has someone written a sample piece of code to demonstrate the most effecient
way to return a newly created primary key whilst doing inserts?

In other words, I insert a record in the author table...I need to now insert
that new primary key (being created by a trigger) into another table, but
only some of the time, so I can't incorporate it into the trigger. Is this a
time to use the old access method, or should I be using a stored procedure,
or what.

Suggestions?

-Deanna



************************************************************
Deanna Schneider
Interactive Media Developer
UWEX Cooperative Extension Electronic Publishing Group
103 Extension Bldg
432 N. Lake Street
Madison, WI 53706
(608) 265-7923



----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to