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

Home -> Community -> Usenet -> c.d.o.server -> Re: Autonumbering

Re: Autonumbering

From: Kingsley Sawyers <no_at_way.im.telling>
Date: Mon, 26 Jul 1999 16:55:59 +0100
Message-ID: <7ni0c8$ri0$1@lure.pipex.net>


Create the SQL command you want and execute it when the database (instance) is running. This creates the Sequence object, for evermore.

Oracle keeps track of the 'next' value on this Sequence for you. Each time you refer to the sequences' NEXTVAL it replaces it in the insert statement being executed (you may also want to check out CURRVAL).

HTH Kingsley

kev wrote in message <379C8172.ECC23891_at_fast.no>...
>Kingsley Sawyers wrote:
>
>> This is done by creating a Sequence object, which can de referred to in
the
>> insert query. Check out the 'CREATE SEQUENCE' command.
>
>OK, I've had a look, it seems that will do the job. Next question is, where
do
>I declare/define it, and when do I run the SQL code (presumably stored in a
>.sql file)? At database creation time? From within the database creation
>script?
>Records will be added via the web (using PHP), if that makes any
difference.
>
>Thanks,
>
>- Kev
>
>>
>>
>> Kingsley
>>
>> kev wrote in message <379C79EA.3CA8B12A_at_fast.no>...
>> >Hi,
>> >
>> >I'm designing a database and need the id fields of my tables
>> >Autonumbered (ie incremented with every 'insert into...'.
>> >This is automatic on, say, M$ Access, but how do I do it in Oracle?
>> >
>> >- Kev
>> >
>
>--
>Kevin Porter
>Web Programmer
>FAST Web Media
>Suite 320, Sunlight House, Quay St, Manchester
>England, M3 3JZ
>
>Phone: 44 (0) 161 835 3525
>Email: kevin.porter_at_fast.no
>Home Page: http://www.fast.no
>All The Web: http://www.alltheweb.com
>FAST FTP Search: http://ftpsearch.lycos.com
>FAST MP3: http://mp3.lycos.com
>FAST Soccer: http://www.fa-premier.com
>FAST Entertainment: http://www.innit.com
>
>
>
Received on Mon Jul 26 1999 - 10:55:59 CDT

Original text of this message

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