CREATE TABLE  TIPOCTRECROP ( 
  CDFILIAL       VARCHAR2(4) NOT NULL, 
  CDTPCTRECEB    VARCHAR2(6) NOT NULL,
  IDTPCTRECROP   VARCHAR2(3) DEFAULT 'CRD' NOT NULL, 
  NRORG          NUMBER   DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL, 
  IDATIVO        VARCHAR2(1) DEFAULT 'S' NOT NULL, 
  DTINCLUSAO     DATE, 
  DTULTATU       DATE, 
  NRORGINCLUSAO  NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg'), 
  CDOPERINCLUSAO VARCHAR2(12) DEFAULT '1', 
  NRORGULTATU    NUMBER  DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg'), 
  CDOPERULTATU   VARCHAR2(12) DEFAULT '1', 
  CONSTRAINT CKC_IDATIVO_CTRECROP     CHECK      (IDATIVO IN ('S','N')), 
  CONSTRAINT PK_TIPOCTRECROP         PRIMARY KEY (CDFILIAL, CDTPCTRECEB, IDTPCTRECROP) ,
  CONSTRAINT CKC_IDTPCTRECROP_IDTIPO CHECK       (IDTPCTRECROP IN ('CRD')), 
  CONSTRAINT FKROP00023TIPOCTREC     FOREIGN KEY (CDTPCTRECEB ) REFERENCES TIPOCTRECEBER (CDTPCTRECEB)
  )
/ 

ALTER TABLE PARFILIALROP ADD IDAPUCTRECROP VARCHAR2(1) DEFAULT 'N' NOT NULL
/

ALTER TABLE PARFILIALROP DROP CONSTRAINT CKC_IDDTAPUCTRECROP
/

ALTER TABLE PARFILIALROP ADD IDDTAPUCTRECROP VARCHAR2(30) DEFAULT 'BAIXA' NOT NULL
/

ALTER TABLE PARFILIALROP ADD CONSTRAINT CKC_IDDTAPUCTRECROP CHECK (IDDTAPUCTRECROP IN ('SAIDA','VENCIMENTO','BAIXA'))
/

ALTER TABLE LANCROPFILIAL DROP CONSTRAINT CKC_IDTPLANCROP
/

ALTER TABLE LANCROPFILIAL DROP CONSTRAINT CKC_IDTPLANCROP_LANCROPFILIAL
/

ALTER TABLE LANCROPFILIAL ADD CONSTRAINT CKC_IDTPLANCROP_LANCROPFILIAL 
                        CHECK (IDTPLANCROP IN ('FS','FE','CC','CS','DE','DD','DM','CD','II','IF','IM','ES','AJ','RE','RP','CP','RA',                 
                               'PP','CM','PV','PQ','FF','C1','C2','I1','I2','IP','A1','R1','R2','SG','S1','S2','RT','SS','SC','FN',
                               'M1','CO', 'EP','FD', 'IV', 'DC', 'DB', 'MR','BP','VN','TX','CR'))
/

ALTER TABLE PROJECAOMANUALROP ADD VRIMPOSTOFOSMAN  FLOAT NULL
/