CREATE TABLE PREVCONSINF (
  NRPREVCONSINF NUMBER(10) NOT NULL, 
  CDPREVCONSINF VARCHAR2(20) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  DTGERACAO DATE NOT NULL, 
  DTINIPREVCONSINF DATE NOT NULL, 
  DTFIMPREVCONSINF DATE NOT NULL, 
  NRORG NUMBER(10) DEFAULT 1 NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'A' NOT NULL, 
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_PREVCONSINF PRIMARY KEY(NRPREVCONSINF, NRORG)
)
/
ALTER TABLE PREVCONSINF ADD CONSTRAINT FKCOC00767FILIAL FOREIGN KEY (CDFILIAL, NRORG) REFERENCES FILIAL (CDFILIAL, NRORG)
/
ALTER TABLE PREVCONSINF ADD CONSTRAINT CKC_IDATIVO_PREVCONSINF CHECK (IDATIVO IN ('S', 'N'))