-- Oracle Table Definition
--
-- RCS Revision
--   $Id: slips.oracle,v 1.8 2000/06/09 04:20:47 billf Exp $
--

CREATE SEQUENCE slips_seq START WITH 1;

CREATE TABLE slips (
    sid number(10) DEFAULT 0 PRIMARY KEY,
    spid number(10) DEFAULT 0 NOT NULL,
    depend number(10),
    o_date number(10),
    o_tech varchar2(50),
    c_date number(10),
    c_tech varchar2(10),
    currtech varchar2(10),
    status char(1),
    priority number(10),
		severity char(1),
    ctag varchar2(20),
    problem varchar2(80),
    summary long, -- Oracle LONG type cannot be indexed or searched
    so_date number(10),
    sc_date number(10),
    grp varchar2(10),
    is_public char(1),
    l_activity number(10),
    l_tech varchar2(50),
    num_children number(10),
    num_follows number(10),
    spolicy number(10),
    caddlabel varchar2(10),
    cphonelabel varchar2(10),
    timespent number(5),
		resource varchar2(10)
);

CREATE INDEX spid_idx ON slips (spid);

CREATE OR REPLACE TRIGGER slips_trg_bir
BEFORE INSERT ON slips
FOR EACH ROW
BEGIN
    IF :new.sid IS NULL OR :new.sid = 0
    THEN
        SELECT slips_seq.nextval INTO :new.sid FROM dual;
    END IF;
END;
/
