Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: CREATING SEQUENCES - HELP PLEASE
On Mon, 20 Oct 1997 11:56:22 +0200, Javier Riera <javier_at_bitel.es>
wrote:
>I am trying to build a table where the identifier must autocalculates
>its own value. Has the sequence object this property?
>I created a secuence as:
>
>CREATE SEQUENCE miSeq
> INCREMENT BY 1
> START WITH 0
> MINVALUE 0
> MAXVALUE 9999999
> NOCYCLE
> CACHE 20
> NOORDER
>;
>
>How can I assign this sequence to my table's identifier?
Do you mean, how do you assign the next value of the sequence to a the key column when you insert a row?
To do this, you need to write a before-insert per-row trigger that sets the value of the key column to the next-val of the sequence. (There is no declarative way to do this that I know of (ala an Access Autonumber).)
Eric Received on Wed Oct 22 1997 - 00:00:00 CDT