Did I miss something? Can't you just Prepare->(insert into table values (sq.nextval,:1,:2,:3)); Execute(col1,col2,col3);
No SP or trigger to fire and no extra network round trips? Ken. -- IT Infrastructure Manager beCogent Ltd T: +44 1236 628140 M: +44 7770 573749 E: [EMAIL PROTECTED] -----Original Message----- From: Kipp, James [mailto:[EMAIL PROTECTED] Sent: 16 June 2004 16:44 To: 'Reidy, Ron'; Jim; [EMAIL PROTECTED] Subject: RE: Best Way to Auto Increment with Oracle > > Better? Maybe. Consider. > > Your program connects via SQL*net to the DB. At insert time, > you need to fetch a sequence, so you issue 'select > seq.nextval from dual'. Seems harmless enough until ... > > 1. The select statement must be passed across the SQL*Net connection. > 2. The statement must be parsed. Maybe the worst you will > have here is a soft parse, but non the less, you are using > the CPU for this. > 3. The statement is executed and the fetch occurs. > 4. The result is passed back to your program. > 5. You bind the value (hopefully) to your statement handle. > 6. You then execute the insert statement. > > If you use a BEFORE INSERT trigger to fetch the sequence, you > will eliminate steps 1, 2, 3, 4, 5 from the flow. > Great point. I think I will stay with the Before insert trigger.
Any opinions expressed in this E-mail may be those of the individual and not necessarily the company. This E-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this E-mail in error and that any use or copying is strictly prohibited. If you have received this E-mail in error please notify the beCogent postmaster at [EMAIL PROTECTED] Unless expressly stated, opinions in this email are those of the individual sender and not beCogent Ltd. You must take full responsibility for virus checking this email and any attachments. Please note that the content of this email or any of its attachments may contain data that falls within the scope of the Data Protection Acts and that you must ensure that any handling or processing of such data by you is fully compliant with the terms and provisions of the Data Protection Act 1984 and 1998.
