Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: autoinc field
You need to use sequences to do this.
create sequence <sequence_name> will do the trick.
To use the sequence, you need to have select privilege on the sequence (and
of course as owner you automatically have).
You have a currval and nextval with sequences.
select sequence.nextval from dual
will increment the sequence.
select sequence.currval from dual
will show the current value.
You can't use currval if you didn't use nextval in the same session before.
In an insert statement you would get
insert into emp
values (sequence.nextval, 'Scott')
and so on.
A sequence is not bound to a particular table.
Hth,
--
Sybrand Bakker, Oracle DBA
Bill Portellie <bill_at_sysbase.com> wrote in message
news:37F97D59.FBF66D93_at_sysbase.com...
> Is it possible to create an autoincrement field in oracle and if so how?
>
> Thanks in advance
>
Received on Mon Oct 04 1999 - 23:40:09 CDT