Re: Autonumber in Oracle

From: (wrong string) Παναγιώτης Λυγνός <lignos_at_intrasoft.gr>
Date: Wed, 22 Sep 1999 11:12:08 +0300
Message-ID: <7sa34c$m4b$1_at_foo.grnet.gr>


There is the this functionality, but it is not implemented directly into the table.
 
You must use a sequence. To create a sequence see the "Create Sequence" command of SQL Then on a trigger either on database (Before Insert) or on a form (PRE-INSERT) you write the following Code:
 
     Select Seq_Name.NextVal
     Into      Field_Name
     From DUAL;
 
where "Seq_Name" the name of the sequence you created and "Field_Name" the column which you want to be autonumbered.
 
Mike Phillips wrote in message
[Quoted] size=2>>Question: Is there autonumber functinality in oracle like in access?  Also,
>is it still a good idea then,
>to create a separate artificial recordID (autonumber) column for each table
>as the primary key.  Or should we actually use real column values, for eg.:
>the combination of 'PartNumber+VendorID'  values as the primary key for the
>tables, keeping in mind that in the end all records in a relational table
>must be unique. I personally liked the autonumber
>idea in MSAccess.
>
>Mike
Received on Wed Sep 22 1999 - 10:12:08 CEST

Original text of this message