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

Home -> Community -> Usenet -> c.d.o.server -> Re: How do I create an Auto Increment Column?

Re: How do I create an Auto Increment Column?

From: dave mausner <dmausner_at_ameritech.x.net>
Date: Fri, 07 Jan 2000 03:52:09 GMT
Message-ID: <8EB3DE649dlm@206.141.192.241>


rxb1_at_lucent.com (rxb1) wrote in <3875190E.212B3659_at_lucent.com>:

>Does anyone know how to create a column that will automatically
>increment
>every time new data is added to the field. Similar to MS Access
>AutoNumber data type or even
>like SQL Server IDENTITY property on the column.
>

perhaps the easiest way would be to define the oracle table with an integer datatype for the auto-increment column. then attach an "insert for each row" trigger which sets the value of the column to a sequence nextval.

you define a sequence using "create sequence MY_SEQ" and you reference the next value by the incantation "MY_SEQ.nextval". --
dave mausner Received on Thu Jan 06 2000 - 21:52:09 CST

Original text of this message

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