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

BEGIN

SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE upper(table_name) = 'CLASSIFCAD' AND UPPER(column_name) = 'CODIGO_GNRE';

EXCEPTION

WHEN NO_DATA_FOUND THEN

begin

EXECUTE IMMEDIATE 'alter table CLASSIFCAD add CODIGO_GNRE integer';

END;

END;
/*------ ATD 409317 ------*/
-- Alteracao da estrutura da tabela ITNFSAICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITNFSAICOMPLEMENTO' AND Upper(column_name) = 'pDIF'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFSAICOMPLEMENTO ADD pDIF NUMERIC(5,2) '; 
END;

-- Alteracao da estrutura da tabela ITNFSAICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITNFSAICOMPLEMENTO' AND Upper(column_name) = 'vICMSDif'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFSAICOMPLEMENTO ADD vICMSDif NUMERIC(15,2) '; 
END;

-- Alteracao da estrutura da tabela CFOSAIDCAD
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'CFOSAIDCAD' AND Upper(column_name) = 'vICMSDif'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE CFOSAIDCAD ADD vICMSDif NUMERIC(15,2) '; 
END;

-- Alteracao da estrutura da tabela ITNFENTCOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITNFENTCOMPLEMENTO' AND Upper(column_name) = 'pDIF'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFENTCOMPLEMENTO ADD pDIF NUMERIC(5,2) '; 
END;

-- Alteracao da estrutura da tabela ITNFENTCOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITNFENTCOMPLEMENTO' AND Upper(column_name) = 'vICMSDif'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFENTCOMPLEMENTO ADD vICMSDif NUMERIC(15,2) '; 
END;

-- Alteracao da estrutura da tabela CFOENTRCAD
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'CFOENTRCAD' AND Upper(column_name) = 'vICMSDif'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE CFOENTRCAD ADD vICMSDif NUMERIC(15,2) '; 
END;

-- Alteracao da estrutura da tabela CFOENTRCAD
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'CFOENTRCAD' AND Upper(column_name) = 'ValTribDif'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE CFOENTRCAD ADD ValTribDif NUMERIC(15,2) '; 
END;
