Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ID/Counter datatype.

Re: ID/Counter datatype.

From: Martin Bronstein <Martin.Bronstein_at_trw.com>
Date: 1997/08/06
Message-ID: <33E89430.41F4@trw.com>#1/1

Guang Yang wrote:
>
> Does anyone happen to know whether Oracle provides the similar datatype
> as identifier/counter in SQL-server/Access, which could be incremented
> by system automatically without using SQL to fill in that field. If that
> datatype is not available in Oracle, is there a way to create another
> approach to inplement similiar type, such as a view?
>
> Any idea will be great appreciated.
>
> Guang.
> --
> -----------------------------------------------------------------------
> Guang Yang phone(H): 515-292-7929
> Dept. of Computer Science /// email: sunlight_at_cs.iastate.edu
> Iowa State University (o o) http://www.cs.iastate.edu/~sunlight
> --------------------------ooO-(_)-Ooo----------------------------------
In Oracle you can create a sequence database object that will generate sequence numbers. For example

CREATE SEQUENCE my_seq INCREMENT BY 1 START WITH 100;

Then you can refer to the sequence via pseudocolumns:

my_seq.currval gives the sequence current value, my_seq.nextval to genterate the next sequence value.

HTH,
Martin Bronstein Received on Wed Aug 06 1997 - 00:00:00 CDT

Original text of this message

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