Re: Autonumber ??

From: Brian Peasland <oracle_dba_at_peasland.com>
Date: Wed, 6 Nov 2002 15:45:41 GMT
Message-ID: <3DC93925.7E2CF3E1_at_peasland.com>


First, you need to create a sequence to do the numbering for you. Then, you need to code a trigger to populate this column automatically, using the sequence for its values.

HTH,
Brian

Gaz wrote:
>
> I want to set mu customer_id column to an autonumber so when data is
> entered into the table the id is automatically set to a number.
> can anyone tell me how to edit my current table to acheive this
>
> CHEERS
>
> create table customer
> ( customer_id varchar2(10) PRIMARY KEY,
> title varchar(4) DEFAULT 'mr' CONSTRAINT check_title CHECK(title in
> ('mr','miss','ms','mrs')),
> surname varchar2(30),
> forename varchar2(30),
> address varchar2(50),
> email varchar2(30),
> bill_address varchar(50),
> corp_cust varchar2(3) DEFAULT 'NO' CONSTRAINT check_corp_cust
> CHECK(corp_cust IN ('YES','NO')),
> corporate_id varchar(10) REFERENCES CORPORATE(corporate_id));
Received on Wed Nov 06 2002 - 16:45:41 CET

Original text of this message