ALTER TABLE COM_HIST_ENCFAC
MODIFY(RECCOMPLETO  NOT NULL);

ALTER TABLE COM_HIST_ENCNAC
MODIFY(RECCOMPLETO  NOT NULL);

ALTER TABLE COM_HIST_ENCFAC add (DISTRIBUCION  number(10));

ALTER TABLE COM_HIST_ENCNAC add (DISTRIBUCION  number(10));

ALTER TABLE COM_HIST_ENCREC add (DISTRIBUCION  number(10));

ALTER TABLE COMLOGCXP
MODIFY(FECHA_REC  DEFAULT SYSDATE);

ALTER TABLE COM_MONTOPROV
ADD CONSTRAINT COMENCFACTURA_MONTOPROV_FK 
FOREIGN KEY (COD_CIA, SUCURSAL, NUM_FACTURA, COD_PROVEEDOR)
REFERENCES COM_ENC_FACTURA (COD_CIA, SUCURSAL, NUM_FACTURA, COD_PROVEEDOR);

ALTER TABLE COMLOGCXP add
CONSTRAINT COMLOGCXP_TIP_CAMBIO_CK CHECK (TIP_CAMBIO >= 0);
--- DROP CONSTRAINT COMLOGCXP_CAMBIOBASE_CK;

ALTER TABLE COMLOGCXP add
CONSTRAINT COMLOGCXP_IND_CXP_CK CHECK (IND_CXP IN ('M','N'));
--- DROP CONSTRAINT COMLOGCXP_IND_CXP_CK;

ALTER TABLE COMLOGCXP
DROP CONSTRAINT COMLOGCXP_ESTADO_CK;
ALTER TABLE COMLOGCXP add
CONSTRAINT COMLOGCXP_ESTADO_CK CHECK (ESTADO IN ('P','A'));

ALTER TABLE COMLOGCXP 
DROP CONSTRAINT COMLOGCXP_TIP_CAMBIO_CK;
ALTER TABLE COMLOGCXP add
CONSTRAINT COMLOGCXP_TIP_CAMBIO_CK CHECK (TIP_CAMBIO >= 0);

ALTER TABLE COMLOGCXP add
CONSTRAINT COMLOGCXP_MONTO_CK CHECK (MONTO >= 0);
-- DROP CONSTRAINT COMLOGCXP_MONTO_CK;

ALTER TABLE COMLOGCXP
DROP PRIMARY KEY CASCADE;
ALTER TABLE COMLOGCXP add 
CONSTRAINT COMLOGCXP_PK PRIMARY KEY (CIA, SUCURSAL, COD_MOVTO, PROVEEDOR, NUM_FACTURA, ACREEDOR, REFERENCIA);

ALTER TABLE COMMATPRO
 DROP PRIMARY KEY CASCADE;
ALTER TABLE COMMATPRO add
CONSTRAINT COMMATPRO_PK PRIMARY KEY (CIA, MATRIZ, FILA, COLUMNA);

ALTER TABLE COMRESFACTURA add
CONSTRAINT COMRESFACTURA_MONTO_CK CHECK (MONTO >= 0);
--- DROP CONSTRAINT COMRESFACTURA_MONTO_CK;

ALTER TABLE COMRESFACTURA add 
CONSTRAINT COMRESFACTURA_DESCUENTO_CK CHECK (DESCUENTO >= 0);
--- DROP CONSTRAINT COMRESFACTURA_DESCUENTO_CK;

ALTER TABLE COMRESFACTURA add 
CONSTRAINT COMRESFACTURA_IMP_VENTA_CK CHECK (IMP_VENTA >= 0);
--- DROP CONSTRAINT COMRESFACTURA_IMP_VENTA_CK;

ALTER TABLE COM_HIST_ENCFAC add 
CONSTRAINT COM_HIST_ENCFAC_RECCOMPLET_CK CHECK (RECCOMPLETO IN ('S','N'));
--- DROP CONSTRAINT COM_HIST_ENCFAC_RECCOMPLET_CK;

ALTER TABLE COM_HIST_ENCNAC add
CONSTRAINT COM_HIST_ENCNAC_RECCOMPLET_CK CHECK (RECCOMPLETO IN ('S','N'));
 ---DROP CONSTRAINT COM_HIST_ENCNAC_RECCOMPLET_CK;