Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: create table option
My problem is that i do not acces from oracle, but from java, and i have to set the first element as auto-increment, i don't want, and i nearly can't, make the increment myself. Don't you know any other solution in the creation of the table that autorize the auto-increment.
Thank's a lot for your answer.
On Tue, 1 Aug 2000 09:41:09 -0400, "Tom Best" <tom.best_at_bentley.com> wrote:
>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
>
>
-- Laurent de Lasteyrie lasteyrie_at_iname.comReceived on Tue Aug 01 2000 - 00:00:00 CDT
![]() |
![]() |