
/*------ ATD 452110 ------*/
-- Adicionando coluna IDTERMPAG na tabela PAGAMENTOVENDA
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PAGAMENTOVENDA' AND Upper(column_name) = 'IDTERMPAG'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PAGAMENTOVENDA ADD IDTERMPAG VARCHAR(40) '; 
END;

-- Adicionando coluna IDTERMPAG na tabela DADOSPAGAMENTONFE
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'DADOSPAGAMENTONFE' AND Upper(column_name) = 'IDTERMPAG'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE DADOSPAGAMENTONFE ADD IDTERMPAG VARCHAR(40) '; 
END;

-- Adicionando coluna DPAG na tabela DADOSPAGAMENTONFE
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'DADOSPAGAMENTONFE' AND Upper(column_name) = 'DPAG'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE DADOSPAGAMENTONFE ADD DPAG DATE) '; 
END;

-- Adicionando coluna indDeduzDeson na tabela DADOSITEMNFE
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'DADOSITEMNFE' AND Upper(column_name) = 'INDDEDUZDESON'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE DADOSITEMNFE ADD INDDEDUZDESON INTEGER) '; 
END;

