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: Help on identity column

Re: Help on identity column

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Fri, 24 Dec 1999 21:08:33 +0100
Message-ID: <946066180.16424.0.pluto.d4ee154e@news.demon.nl>


You need to create a separate sequence. A sequence is not bound to a specific table, which can come in very handy. You need to use either insert into table values (sequence.nextval) and/or create a before insert trigger after each row, testing the primary key and assigning sequence.nextval when the pk is still null.

Hth,

--
Sybrand Bakker, Oracle DBA
Larry Coon <lmcoon_at_home.com> wrote in message news:3863C2A8.1AD1_at_home.com...
> If somebody could help a Sybase user, I'd appreciate
> it. I want to create a table in Oracle 8 where the
> numeric primary key has the eqivalent of Sybase's
> "identity" property. That is, the system automatically
> maintains a sequential counter. Eg, in Sybase:
>
> create table my_table (
> key_col numeric(10) identity,
> non_key_col char(10)
> )
>
> With the "identity" property, Sybase will automatically
> generate the value for key_col, using 1, 2, 3, etc.
>
> How is this done in Oracle 8?
>
> Thanks,
>
> Larry Coon
> lmcoon_at_home.com
Received on Fri Dec 24 1999 - 14:08:33 CST

Original text of this message

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