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: auto-increment?

Re: auto-increment?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sat, 7 Apr 2001 21:50:30 +0200
Message-ID: <tcusrurbm0jf65@beta-news.demon.nl>

"Luke" <anduguid_at_NOThome.com> wrote in message news:c2Kz6.222185$tP3.3388628_at_news1.rdc1.bc.home.com...
> g;day,
> is there a way to do this with oracle?
>
> CREATE TABLE cookbooktb (
> id int(11) NOT NULL auto_increment,
> user_recipe_name varchar(60),
> recipe_category_id int(11),
> ingredients text,
> preparation text,
> notes text,
> PRIMARY KEY (id)
> );
>
> most notably the auto_increment part? or is it up to the programmer to
> increment it manually for each insertion?
>
> i got this far...
>
> SQL> describe cookbooktb;
> Name Null? Type
> ----------------------------------------- -------- ----------------------
 --
> ----
> ID NOT NULL NUMBER(11)
> USER_RECIPE_NAME VARCHAR2(60)
> RECIPE_CATEGORY_ID NUMBER(11)
> INGREDIENTS VARCHAR2(2000)
> PREPERATION VARCHAR2(2000)
> NOTES VARCHAR2(2000)
>
>
> NB. the create table sql above was taken from a mysql DB dump.
>
> luke
> --
> ***remove the NOT from the email address***
>
>

You need to create a sequence and increment the sequence in a before insert for each row trigger.
Details in the Oracle Applications Developers Guide.

Hth,

Sybrand Bakker, Oracle DBA Received on Sat Apr 07 2001 - 14:50:30 CDT

Original text of this message

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