ALTER TABLE VIGFREQPRODGRPRAT ADD CONSTRAINT FKPLA00981FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
ALTER TABLE FREQPRODGRPRAT ADD NRVIGENCIA NUMBER NULL
/
ALTER TABLE FREQPRODGRPRAT ADD CONSTRAINT FKPLA00982VIGFREQPRODGRPRAT FOREIGN KEY (NRVIGENCIA) REFERENCES VIGFREQPRODGRPRAT (NRVIGENCIA) ON DELETE CASCADE
/
CREATE INDEX FKPLA00982VIGFREQPRODGRPRAT ON FREQPRODGRPRAT (NRVIGENCIA)
/
CREATE TABLE VIGFREQPRATMES (
  NRVIGENCIA NUMBER(10) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  DTVIGENCIA DATE NOT NULL, 
  DESCRICAO VARCHAR2(250) DEFAULT NULL NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_VIGFREQPRATMES PRIMARY KEY(NRVIGENCIA)
)
/
ALTER TABLE VIGFREQPRATMES ADD CONSTRAINT CKC_IDATIVO_VIGFREQPRATMES CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE VIGFREQPRATMES ADD CONSTRAINT UN_VIGFREQPRATMES UNIQUE (CDFILIAL, DTVIGENCIA)
/
ALTER TABLE VIGFREQPRATMES ADD CONSTRAINT FKPLA00983FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
CREATE INDEX FKPLA00983FILIAL ON VIGFREQPRATMES (CDFILIAL)
/
ALTER TABLE FREQPRATMES ADD NRVIGENCIA NUMBER NULL
/
ALTER TABLE FREQPRATMES ADD CONSTRAINT FKPLA00984VIGFREQPRATMES FOREIGN KEY (NRVIGENCIA) REFERENCES VIGFREQPRATMES (NRVIGENCIA) ON DELETE CASCADE
/
CREATE INDEX FKPLA00984VIGFREQPRATMES ON FREQPRATMES (NRVIGENCIA)