Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: World's No.1 SQL server!! PostgreSQL defeated Oracle, MS SQLserver, DB2, Sybase, Interbase....!!!!
"Leonard F Clark" <lfc_at_zoom.co.uk> wrote in message
news:3a16bdec.10719183_at_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.
Great sequence summary, except the subquery isn't necessary. You can do this:
update target_table
set increment_field = sequence.nextval;
Received on Sat Nov 18 2000 - 17:22:24 CST
![]() |
![]() |