Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Identity column?
I implement IDENTITY by creating a sequence and an on insert trigger e.g.
>CREATE SEQUENCE SEQ_MYTAB_IDENT ;
>CREATE OR REPLACE TRIGGER MYTAB_IDENT BEFORE INSERT ON MYTAB
REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
BEGIN
select seq_mytab.nextval into :new.identity from dual ;
END ;
Good luck,
John
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 - 17:16:25 CDT