
/*------ ATD 405899 ------*/
-- Adicionando coluna DIFERENCABASE na 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) = 'DIFERENCABASE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFSAICOMPLEMENTO ADD DIFERENCABASE NUMERIC(15,2) default 0 null '; 
END;

-- Adicionando coluna BASEEXCEDENTE na 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) = 'BASEEXCEDENTE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFSAICOMPLEMENTO ADD BASEEXCEDENTE NUMERIC(15,2) default 0 null '; 
END;

-- Adicionando coluna DIFERENCABASE na 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) = 'DIFERENCABASE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFENTCOMPLEMENTO ADD DIFERENCABASE NUMERIC(15,2) default 0 null '; 
END;

-- Adicionando coluna BASEEXCEDENTE na 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) = 'BASEEXCEDENTE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITNFENTCOMPLEMENTO ADD BASEEXCEDENTE NUMERIC(15,2) default 0 null '; 
END;

-- Adicionando coluna DIFERENCABASE na 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) = 'DIFERENCABASE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE CFOSAIDCAD ADD DIFERENCABASE NUMERIC(15,2) default 0 null '; 
END;

-- Adicionando coluna DIFERENCABASE na 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) = 'DIFERENCABASE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE CFOENTRCAD ADD DIFERENCABASE NUMERIC(15,2) default 0 null '; 
END;