Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: ID/Counter datatype.
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
![]() |
![]() |