CREATE TABLE ITFREQGRPRATMES (
  NRITFREQGRPRATMES NUMBER(10) NOT NULL, 
  NRFREQGRPRATMES NUMBER(10) NOT NULL, 
  NRGRUPOPRATO NUMBER(10) NOT NULL, 
  NRMINFREQGRPRATMES NUMBER(10) NOT NULL, 
  NRMAXFREQGRPRATMES NUMBER(10) NOT NULL, 
  NRMAXFREQGRPRATSEM NUMBER(10) NOT NULL, 
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_ITFREQGRPRATMES PRIMARY KEY(NRITFREQGRPRATMES, NRORG)
)
/
ALTER TABLE ITFREQGRPRATMES ADD CONSTRAINT FKPLA00940FREQGRPRATMES FOREIGN KEY (NRFREQGRPRATMES, NRORG) REFERENCES FREQGRPRATMES (NRFREQGRPRATMES, NRORG)
/
ALTER TABLE ITFREQGRPRATMES ADD CONSTRAINT FKPLA00941GRUPOPRATO FOREIGN KEY (NRGRUPOPRATO, NRORG) REFERENCES GRUPOPRATO (NRGRUPOPRATO, NRORG)
/
ALTER TABLE ITFREQGRPRATMES ADD CONSTRAINT CKC_IDATIVO_ITFREQGRPRATMES CHECK (IDATIVO IN ('S','N'))
/
CREATE INDEX FKPLA00940FREQGRPRATMES ON ITFREQGRPRATMES (NRFREQGRPRATMES, NRORG)