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: Tony <tony_at_iat.net>
Date: Tue, 14 Apr 1998 19:47:45 -0400
Message-ID: <3533f5f5.0@news.inetnow.net>


The below syntax is almost correct. You cannot use :new.col1:= Table1_Sequence.NextVal; in a trigger. First select into a number and then make the assignment.

Tony

Ken Leach wrote in message <352B94F2.D264CDC0_at_ids.net>...
>Use a sequence...
>and create an on-insert trigger for that table that will populate the PK
row
>from the sequence.
>
>CREATE SEQUENCE Table1_Sequence INCREMENT BY 1 START WITH 10;
>CREATE TRIGGER Tabel1_BI BEFORE INSERT ON Table1
>Begin
> :new.col1:= Table1_Sequence.NextVal;
>End;
>
>
>That was from memory, you should check the syntax.
>There is also ROWID's that Oracle stores for you, but they could change.
>
>-Ken Leach
> Shoreline Software
>
>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).
>>
>> later,
>> graham
>>
>> graham miller "Computers are useless. They can only
>> gjm_at_cs.stanford.edu give you answers." -- Pablo Picasso
>
>
>
Received on Tue Apr 14 1998 - 18:47:45 CDT

Original text of this message

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