Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: "autonumber" field - how to?
You have to create a sequence before you can use it,
make sure when you create the sequence, by default
cache is 20, you should use NOCACHE.
In article <gre_3.60$Ld.14463_at_newsin1.ispchannel.com>,
"Bill Cohagan" <bill_at_XNOSPAMXteraquest.com> wrote:
> I'm an Oracle newbie, having worked previously in Access and SQL7.
In both
> of these systems I am able to easily create an "autonumber" field;
i.e., a
> field that is automatically assigned sequential integers as new
records are
> created. I'm having difficulty figuring out how to do this in Oracle
8. (I'm
> actually using Personal Edition O8).
>
> I've discovered the Sequence object and that is clearly the mechanism
to be
> used. I've also discovered that you cannot reference this object (or
its
> NEXTVAL pseudocolumn) in the DEFAULT spec for a column. I've also
attempted
> writing an INSERT trigger, but can't get it to compile. The
statement:
>
> :new."ID Field" := table_SEQ.NEXTVAL
>
> causes a "trigger compiled with errors" message. When I then type
SHOW
> ERRORS, I get "No Errors" !!! If I change the line to:
>
> :new."ID Field" := 99
>
> then it compiles fine.
>
> I would appreciate hearing from anyone who can help me solve this
problem.
>
> TIA,
> Bill
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Nov 23 1999 - 13:51:02 CST
![]() |
![]() |