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: IDENTITY?

Re: IDENTITY?

From: Nicholas Whitehead <nickman_at_cybernex.net>
Date: Thu, 16 Apr 1998 21:19:45 GMT
Message-ID: <353674db.35644944@news2.new-york.net>


On Wed, 15 Apr 1998 15:44:19 +0200, peter.p.lundstrom_at_telia.se wrote:

Oracle has sequences which are distinct objects used for generating unique id's. They are not directly associated with columns, though, as identity columns are in Sybase. However, they do give you a little more flexibility.

create sequence MY_SEQUENCE increment by 1 start with 1 nomaxvalue nocycle cache 10; -- my subjective criteria

To get a value you can

  1. select MY_SEQUENCE.nextval from dual
  2. insert into MY_TABLE ( A ) values ( MY_SEQUENCE.nextval )

You can create a trigger to populate a column automatically.

Nicholas Whitehead
nwhitehead_at_gt.com

>Graham Miller wrote:
>>
>> Hello all,
>> Is there any way to get Oracle7 to create a unique value for a given
>> column when a row is inserted (like the IDENTITY feature in Sybase)? Any
>> help would be appreciated (by email, please).
>
>
>U can use row_id I think
>Peter
Received on Thu Apr 16 1998 - 16:19:45 CDT

Original text of this message

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