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

Home -> Community -> Usenet -> c.d.o.tools -> Re: World's No.1 SQL server!! PostgreSQL defeated Oracle, MS SQLserver, DB2, Sybase, Interbase....!!!!

Re: World's No.1 SQL server!! PostgreSQL defeated Oracle, MS SQLserver, DB2, Sybase, Interbase....!!!!

From: Leonard F Clark <lfc_at_zoom.co.uk>
Date: Sat, 18 Nov 2000 17:42:11 GMT
Message-ID: <3a16bdec.10719183@125.0.0.1>

>> In fact I'm currently trying to test Oracle myself for a German client, and
>> have
>> hit a brick wall. Does Oracle have an AutoIncrement field (i.e an
>> automatically increasing counter)? My German is normally OK but all my docs
>> are in German and I can't guess what the German should be for this! Can
>> anyone help please???
>>

Oracle implements "autoincrement" through what are known as sequences. A sequence is a database object (like a table or an index). You can define as many as you like and each are named by you. However, you don't simply mark a field as autoincrement; you have to select the next value by something like:

      update target_table
          set increment_field = ( select sequence.nextval from
sys.dual );

where sys.dual is a dummy table.

You can configure the start value and maximum value of the sequence, as well as the interval (i.e. you can jump 100s rather than 1s). You can also choose whether to cycle once you hit the maximum value or not.

By default, Oracle loads a cache of sequence values into memory. This can mean that you don't get strict sequence (IOW you can get gaps in the sequence). However, you can configure the sequence to prevent this also (but at some loss of performance).

Email me if you want to know more about this.

Len Received on Sat Nov 18 2000 - 11:42:11 CST

Original text of this message

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