CREATE TABLE ITRATEFECLIFAT (
  DTINCLUSAO DATE DEFAULT NULL NULL, 
  NRITEMRATEIOEFET NUMBER(10) NOT NULL, 
  IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTULTATU DATE DEFAULT NULL NULL, 
  QTEFETIVOS DOUBLE PRECISION NOT NULL, 
  NRORG NUMBER(10) DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  NRITRATEFECLIFAT VARCHAR2(255) NOT NULL, 
  CDFILIAL VARCHAR2(4) NOT NULL, 
  CDSERVFILI VARCHAR2(5) NOT NULL, 
  CDCLIENTE VARCHAR2(21) NOT NULL, 
  DTFATURAM DATE NOT NULL, 
  NRORGINCLUSAO NUMBER(10) DEFAULT 1 NULL, 
  CDSERVPLAN VARCHAR2(5) NOT NULL, 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1' NULL, 
  NRORGULTATU NUMBER(10) DEFAULT 1 NULL, 
  CDOPERULTATU VARCHAR2(12) DEFAULT '1' NULL,
  CONSTRAINT PK_ITRATEFECLIFAT PRIMARY KEY(NRITRATEFECLIFAT)
)
/
ALTER TABLE ITRATEFECLIFAT ADD CONSTRAINT CKC_IDATIVO_ITRATEFECLIFAT CHECK (IDATIVO IN ('S', 'N'))
/
ALTER TABLE ITRATEFECLIFAT ADD CONSTRAINT UN_ITRATEFECLIFAT UNIQUE (CDFILIAL, CDSERVFILI, CDCLIENTE, DTFATURAM, CDSERVPLAN, NRITEMRATEIOEFET)
/
CREATE INDEX FKPLA00999EFECLIFAT ON ITRATEFECLIFAT (CDFILIAL, CDSERVFILI, CDCLIENTE, DTFATURAM, CDSERVPLAN)
/
CREATE INDEX FKPLA01000ITEMRATEIOEFET ON ITRATEFECLIFAT (NRITEMRATEIOEFET)