Re: Identity columns in Oracle?

From: Rick Rutt <rrutt_at_delphi.com>
Date: 1996/06/18
Message-ID: <R3EsM20.rrutt_at_delphi.com>#1/1


Erik Foley <erikf_at_boris.dataworks.com> writes:  

>I wonder if Oracle has some version of the Sybase 'Identity' column attribute?
>In Sybase, you can specify a key column as an Identity column. Then, when you
>perform an Insert to that table, if you don't supply a value for the Identity
>column, Sybase will find the greatest value in the table, and increment it for
>the new row. That may be an overly simplistic explanation, but it's
>reasonable accurate. So, does Oracle have anything similar?
 

Oracle has Sequences, which can be SELECTed from to get increasing numeric values. (Rolled back transactions may cause "holes" in the sequence.)  

Typically, you put a Before-Insert trigger on the table to assign a value from a given Sequence to a numeric column in the Table that will act as the system-assigned primary key.  

  • Rick --

(Rick Rutt is a system architect living and working in Midland, Michigan.) Received on Tue Jun 18 1996 - 00:00:00 CEST

Original text of this message