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

Home -> Community -> Usenet -> c.d.o.misc -> Re: "autonumber" field - how to?

Re: "autonumber" field - how to?

From: <lily99_at_my-deja.com>
Date: Tue, 23 Nov 1999 19:51:02 GMT
Message-ID: <81er75$d12$1@nnrp1.deja.com>


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

Original text of this message

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