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

Home -> Community -> Usenet -> c.d.o.tools -> Re: create table option

Re: create table option

From: Tom Best <tom.best_at_bentley.com>
Date: 2000/08/01
Message-ID: <8m6jr9$b6c$1@news.bentley.com>#1/1

Regarding the primary key syntax:

    create table T (a int primary key, b char(10))

Regarding the auto-increment: as quoted from a previous post by Thomas Kyte:



we use sequences for that:

create sequence myseq;
create trigger my_trigger
before insert on T for each row
begin
  if ( :new.column_to_fill_in is null ) then     select myseq.nextval into :new.column_to_fill_in from DUAL; end if; end;
/



HTH,
Tom Best

Laurent de Lasteyrie <lasteyrie_at_iname.com> wrote in message news:3986c728.80973513_at_news.issy.cnet.fr...
> I have a table with a number that must inscrease automaticaly
> (it's a code) and must be a primary key, i've tried to do :
>
> Create Table Edit
> (CE Counter CONSTRAINT PrimaryKey PRIMARY Key,Nom_ Char(20));
>
> That work in other language but not in oracle. does anyone can
> help me telling me how to do the same in Oracle.
>
> Thank's in advance.
>
> --
> Laurent de Lasteyrie
> lasteyrie_at_iname.com
Received on Tue Aug 01 2000 - 00:00:00 CDT

Original text of this message

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