Re: Does Oracle has an automatic counter field data type?

From: Andrea Cannaos <Andrea.Cannaos_at_deagostini.it>
Date: 1998/04/16
Message-ID: <35363674.78B9EC63_at_deagostini.it>#1/1


Sami Heikkinen wrote:

> Hi!
>
> Does Oracle has an automatic counter field data type for generating
> primary keys (incrementally) automatically. I need to implement this kind
> of surrogate key for tables. This kind of field type is used in MS Access
> and is type of counter field. It works like this: when a new record is
> added into table the primary key field is automatically generated by the
> DBMS without a need for user interference.
>

Every record into the table has his internal ROWID that is also a unique key and you can have it in a SELECT statement (es. select ROWID from EMP).

You can can write a SEQUENCE and you can USE IT in a DATABASE TRIGGER  (look for SEQUENCE and DATABASE TRIGGERS in your manuals)

--
           \\\\////
           &( oo )&
========oOO==(__)==OOo========
|                            |
|Andrea.Cannaos_at_deagostini.it|
|                            |
==============================
            ||   ||
           (__) (__)
Received on Thu Apr 16 1998 - 00:00:00 CEST

Original text of this message