CREATE TABLE  rich700_trb3lookup (
  id                   NUMBER(8)  NOT NULL,
  det_part_id          NUMBER(1),
  vers_id              NUMBER(8)  NOT NULL
                                  CONSTRAINT  rich700_trb3lookup_vers_fk2
                                  REFERENCES  rich700_trb3lookup_vers (vers_id),
  context_id           NUMBER(8)  NOT NULL 
                                  CONSTRAINT rich700_trb3lookup_context_fk2
                                  REFERENCES hanal2.treepar_context (context_id),
  valid_since          DATE       NOT NULL,
  valid_until          DATE       NOT NULL,
  date_create          DATE       NOT NULL,
  invalid_since        DATE       NOT NULL,
  comment_id           NUMBER(8)  CONSTRAINT rich700_comment_fk3
                                  REFERENCES rich_comment (rich_comment_id),
  CONSTRAINT rich700_trb3lookup_pk PRIMARY KEY (id)
    USING INDEX PCTFREE 2 STORAGE (INITIAL 16K NEXT 16K PCTINCREASE 0),
  CONSTRAINT rich700_trb3lookup_unq UNIQUE (vers_id,context_id,valid_until,invalid_since)
    USING INDEX PCTFREE 2 STORAGE (INITIAL 32K NEXT 32K PCTINCREASE 0))
PCTUSED 95 PCTFREE 5 STORAGE (INITIAL 32K NEXT 32K PCTINCREASE 0);

COMMENT ON TABLE rich700_trb3lookup IS 'Versions of the TRB3 lookup table used by the  rich700 detector TRB3 Unpacker';
COMMENT ON COLUMN rich700_trb3lookup.id IS 'Primary key (identifier for the entry)';
COMMENT ON COLUMN rich700_trb3lookup.det_part_id IS 'not used';
COMMENT ON COLUMN rich700_trb3lookup.vers_id IS 'Version of the parameters, references rich700_trb3lookup_vers.vers_id';
COMMENT ON COLUMN rich700_trb3lookup.context_id IS 'Id of parameter context, references hanal2.treepar_context.context_id';
COMMENT ON COLUMN rich700_trb3lookup.valid_since IS 'Date (Run start) when this parameter set gets valid';
COMMENT ON COLUMN rich700_trb3lookup.valid_until IS 'Date (Run stop) when this parameter set gets invalid';
COMMENT ON COLUMN rich700_trb3lookup.date_create IS 'Date when the entry was made';
COMMENT ON COLUMN rich700_trb3lookup.invalid_since IS 'Date when this parameter set was (will be) replaced';
COMMENT ON COLUMN rich700_trb3lookup.comment_id IS 'Identifier for the comment, references rich700_comment.rich700_comment_id';
