Unfortunately I don't have the ref books and I am rooting through oracle.com.  In doing so I found a sequence that I think can be cobbled into  what I need, thought it has a reference to DUAL and I don't know what that is.  Here it is:

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

CREATE SEQUENCE uniqueNum_s START WITH 1
   INCREMENT BY 1;
   CREATE OR REPLACE TRIGGER hhp_calendar
   BEFORE INSERT ON id FOR EACH ROW
DECLARE
    v_id id%type;
BEGIN
   SELECT uniqueNum_s.nextval INTO v_id FROM DUAL;
   :new.id = v_id;
END;

> 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.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to