-- Oracle Table Definition
--
-- RCS Revision
--   $Id: eschema.oracle,v 1.1 1999/02/02 17:07:58 roberts Exp $
--

CREATE SEQUENCE eschema_seq START WITH 1;

CREATE TABLE eschema (
    x_rowid int DEFAULT 0 PRIMARY KEY,
    etable varchar2(15) NOT NULL,
    element varchar2(15),
    etype varchar2(1),
    eflags varchar2(80),
    esequence int,
    elength int,
    elabel varchar2(20)
);

CREATE INDEX eschema_etable_idx ON eschema(etable);

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