Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How do I create an Auto Increment Column?
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