
/*------ ATD 412149 ------*/
-- Adicionando coluna USUARIOALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PEDICLICOMPLEMENTO' AND Upper(column_name) = 'USUARIOALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PEDICLICOMPLEMENTO ADD RITEMVOLUME USUARIOALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna ESTACAOALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PEDICLICOMPLEMENTO' AND Upper(column_name) = 'ESTACAOALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PEDICLICOMPLEMENTO ADD RITEMVOLUME ESTACAOALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna PROGRAMAALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PEDICLICOMPLEMENTO' AND Upper(column_name) = 'PROGRAMAALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PEDICLICOMPLEMENTO ADD RITEMVOLUME PROGRAMAALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna DATAALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PEDICLICOMPLEMENTO' AND Upper(column_name) = 'DATAALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PEDICLICOMPLEMENTO ADD RITEMVOLUME DATAALTEROUSITMANUT DATE '; 
END;
---------------------------------------------------------------------
-- Adicionando coluna USUARIOALTEROUSITMANUT na tabela ITEMFATURADO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITEMFATURADO' AND Upper(column_name) = 'USUARIOALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITEMFATURADO ADD RITEMVOLUME USUARIOALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna ESTACAOALTEROUSITMANUT na tabela ITEMFATURADO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITEMFATURADO' AND Upper(column_name) = 'ESTACAOALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITEMFATURADO ADD RITEMVOLUME ESTACAOALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna PROGRAMAALTEROUSITMANUT na tabela ITEMFATURADO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITEMFATURADO' AND Upper(column_name) = 'PROGRAMAALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITEMFATURADO ADD RITEMVOLUME PROGRAMAALTEROUSITMANUT VARCHAR(100 '; 
END;
--
-- Adicionando coluna DATAALTEROUSITMANUT na tabela ITEMFATURADO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ITEMFATURADO' AND Upper(column_name) = 'DATAALTEROUSITMANUT'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE ITEMFATURADO ADD RITEMVOLUME DATAALTEROUSITMANUT DATE '; 
END;