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

Home -> Community -> Usenet -> c.d.o.misc -> Re: auto increment? 'enum' data type?

Re: auto increment? 'enum' data type?

From: M. Armaghan Saqib <armaghan_at_yahoo.com>
Date: Wed, 26 Jan 2000 08:03:42 GMT
Message-ID: <86m9ot$q99$1@nnrp1.deja.com>


I just had a detailed answer to a similar question.

  1. Oracle does not support access/sqlserver like "Autonumber" columns but supports a sequence object which you can "bind" to a table column (number type) using a pre-insert trigger.
  2. Oracle does support this type of functionality using CHECK constraints on a table.

My SQL PlusPlus (freeware) generated all the code required for both of above.

BLDSEQ command will generate code to create sequence and the required pre-insert trigger.

BLDCON command generates an example of CHECK constraint which you can modify to suit your requirement.

regards,
M. Armaghan Saqib


in article <86lv65$jfu$1_at_nnrp1.deja.com>,   Otis Gospodnetic <otis_at_my-deja.com> wrote:
> Hi,
>
> I'm new to Oracle and am wondering what's the best/easiest way to
make a
> column 'auto increment' (e.g. an ID column used as a primary key)?
> Do I have to make a sequence in my schema for that particular
> column/table/database? Or can I specify something like 'AUTO
INCREMENT'
> when I do CREATE TABLE .... (doesn't seem to be the case).
>
> I am also wondering if there is a data type that will let me specify a
> list of all possible values that a column can have, so that no other
> value can be inserted in that column?
> In MySQL I would do somehting like this, for example:
> gender enum('Male','Female')
> How about under Oracle?
>
> Thanks,
>
> Otis
> P.S.
> I ordered an Oracle book, it's just hasn't been delivered yet...

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Jan 26 2000 - 02:03:42 CST

Original text of this message

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