-- Oracle Table Definition
--
-- RCS Revision
--   $Id: state.oracle,v 1.3 1999/11/30 20:38:00 shevett Exp $
--

CREATE SEQUENCE state_seq START WITH 1;

CREATE TABLE state (
    x_rowid int NOT NULL PRIMARY KEY,
    userid varchar2(20) NOT NULL,
    mslip number(10),
    mcont number(10),
    mresource number(10),
    mdataset varchar2(10),
    mother number(10),
    slipzoom number(10),
    reszoom varchar2(10),
    filters number(10),
    properties varchar2(200),
		mlibrary number(1),
    contzoom varchar2(10),
    contlist varchar2(200)
);

CREATE INDEX state_userid_idx ON state(userid);

CREATE OR REPLACE TRIGGER state_trg_bir
BEFORE INSERT ON state
FOR EACH ROW
BEGIN
    IF :new.x_rowid IS NULL OR :new.x_rowid = 0
    THEN
        SELECT state_seq.nextval INTO :new.x_rowid FROM dual;
    END IF;
END;
/
