
/*------ ATD 320814 ------*/
DECLARE v_count NUMBER:=0;

BEGIN

SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE UPPER(table_name) = 'TABTRANFAT' AND Upper(COLUMN_NAME) = 'TIPOTRANSPORTADOR';

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'ALTER TABLE TabTranFat ADD TipoTransportador NUMERIC(1,0) DEFAULT 0 NOT NULL;';

END IF;

SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE UPPER(table_name) = 'MANIFESTOCARGADOCUMENTO' AND Upper(COLUMN_NAME) = 'INDREENTREGA';

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'ALTER TABLE ManifestoCargaDocumento ADD IndReentrega NUMERIC(1,0) DEFAULT 0 NOT NULL;';

END IF;

SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE UPPER(table_name) = 'MANIFESTOCARGA' AND Upper(COLUMN_NAME) = 'CODIGOCHAVE';

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'ALTER TABLE ManifestoCarga ADD CodigoChave NUMERIC(8,0) DEFAULT 0 NOT NULL;';

END IF;

END;