Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Identity column?
There isn't such a type in Oracle (at least V7), you have to create a
sequence, the create a before insert trigger which grabs the next value from
the sequence and sets the identity field to that value.
i.e.
table is t_mytable with a column called identity, sequence named s_mysequence
CREATE OR REPLACE TRIGGER bi_mytable BEFORE INSERT ON t_mytable AS
DECLARE
v_identity INTEGER;
BEGIN
SELECT s_mysequecne.NEXTVAL INTO v_identity FROM DUAL; :new.identity := v_identity;
Cheers
Dave Waterworth
Bill Weaks <bill_at_indmolding.nospam.com> wrote in message
news:3810DBA0.66C5AFCF_at_indmolding.nospam.com...
> Sounds silly, I suppose, but I can't find documentation on how to create
> an IDENTITY column in Oracle 7!
>
> I see ROWID, but that doesn't cut it.
>
> My experience thus far has been with MS SQL 6.5+, and they have a way to
> create an autoincrementing field in a table.
>
> Could somebody shed some light, please?
>
> Thanks
>
Received on Fri Oct 22 1999 - 19:29:10 CDT
![]() |
![]() |