Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sequnce as an id
You need to use a BEFORE-INSERT trigger to populate the primary key column
from the sequence. Oracle does not do this all by itself.
Ed Zappulla wrote in message <7crvun$ls3$1_at_winter.news.rcn.net>...
>Does anyone know how to specifiy a sequence as a default value for a
primary
>key id? I want to do an auto number without having to explicitly set the
>value for each insert. ie:
>
>create sequence seq_id;
>
>create table x
>(
> id number default x.nextval not null, ---- bad syntax.
>how to do this?
> name varchar2(255) not null
>);
>
>insert into x (name) values ('xxxx');
>
>
>
Received on Thu Mar 18 1999 - 17:33:07 CST