Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORACLE and a Counter field or Identity????

Re: ORACLE and a Counter field or Identity????

From: Dan Clamage <clamage_at_mime.dw.lucent.com>
Date: 1997/11/12
Message-ID: <01bcef6c$99057770$54110b87@clamagent>#1/1

> Try looking up sequence generators in manual as this would be a better
 approach
> than using a trigger. Then you can do the insert like:
> insert into table_name (col1, col2, etc...)
> values (sequence_name.nextval,:var2,etc...)
Definitely use sequence objects to generate the next value for your numeric primary key. Now, some people like to use triggers to provide this value, and others will do it in the client code as the previous author illustrated; and a few others will write a stored procedure to encapsulate the actual INSERT statement with the sequence object reference. If you're feeling slick, you can write a program to generate stored procedure code, and save yourself a lot of work in the long run. -djc Received on Wed Nov 12 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US