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: CREATING SEQUENCES - HELP PLEASE

Re: CREATING SEQUENCES - HELP PLEASE

From: Andy Hardy <Andy_Hardy_at_camk.demon.co.uk>
Date: 1997/10/29
Message-ID: <pS90rNAJ5yV0MwVU@camk.demon.co.uk>#1/1

In article <344B2AC6.47A5_at_bitel.es>, Javier Riera <javier_at_bitel.es> writes
>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?
>
>Thanks.

If you want the identifier to have a unique value, you will need to call the sequence explicitly e.g.

INSERT INTO my_table

        (
        mi_id, 
        mi_value
        )
        VALUES
        (
        miSeq.NEXTVAL,
        'a value'
        );

You could also assign the identifier through a database trigger on the table.

Andy

-- 
Andy Hardy
Senior IT Systems Engineer
Cegelec AEG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions are mine and do not necessarily reflect those of Cegelec AEG
Received on Wed Oct 29 1997 - 00:00:00 CST

Original text of this message

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