Oracle doesn't have any kind of unique-id or identity datatype for table columns. Instead, you need to use a "SEQUENCE" which is a standalone object inside an Oracle schema which generates unique numbers based on how you define the sequence when it's created. So, to use that in a table, you need to create a sequence, and then create your table with a column called something like "ID" with a NUMBER datatype, and when you insert new records into that table, the ID column value becomes something like <your_sequence_name.nextval> (without the <>s). For more information about it, lookup SEQUENCE in the Oracle SQL Reference.


<.YEX.>

-----Original Message-----
From: Daniel Kessler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 4:09 PM
To: CF-Talk
Subject: oracle unique id or identity

I'm trying to make an auto-incrementing ID field in ORACLE.  In sql,
I believe that I make it have an attribute of IDENTITY.  I can't seem
to find how to do that in ORACLE.  Here's my latest attempt:

create table hhp_calendar (
     id INT unique id,
     dateAdded date,
     event_date date,
     header VARCHAR2(200),
     description VARCHAR2(3000),
     http VARCHAR2(100),
     image VARCHAR2(100),
     image_h INT,
     image_w INT
)

He-elp.

--
Daniel Kessler

Department of Public and Community Health
University of Maryland
Suite 2387 Valley Drive
College Park, MD  20742-2611
301-405-2545 Phone
www.phi.umd.edu
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to