
/*------ ATD 237680 ------*/
MERGE into dadoadicional using dual on (oid = 37137) when not matched theninsert ( RCLASSECONCRETA,RAPLICATIVO,RDOMINIO,RLISTA,RTIPO,RITEM,RESTRICAO,VISIVEL,MASCARA,PADRAO,MAXIMO,MINIMO,VALOR,OID)values (7,7 ,7,7,1014,2123,0,0,'','',1,0,'Percentual de COFINS a ser aplicado na garantia',37137);MERGE into dadoadicional using dual on (oid = 37136) when not matched theninsert ( RCLASSECONCRETA,RAPLICATIVO,RDOMINIO,RLISTA,RTIPO,RITEM,RESTRICAO,VISIVEL,MASCARA,PADRAO,MAXIMO,MINIMO,VALOR,OID)values (7,7 ,7,7,1014,2123,0,0,'','',1,0,'Percentual de PIS a ser aplicado na garantia',37136);-- Adicionando coluna TIPOSERVICO na tabela PRODUTOTEXTO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'PRODUTOTEXTO' AND Upper(column_name) = 'TIPOSERVICO'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE PRODUTOTEXTO ADD TIPOSERVICO NUMERIC(1,0) default 0 not null '; 
END;

-- Adicionando coluna VALORESTIPULANTE, PERCESTIPULANTE na tabela SERVICO
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'SERVICO' AND Upper(column_name) = 'VALORESTIPULANTE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE SERVICO ADD VALORESTIPULANTE NUMERIC(18,5) default 0 not null '; 
END;

DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'SERVICO' AND Upper(column_name) = 'PERCESTIPULANTE'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE SERVICO ADD PERCESTIPULANTE NUMERIC(6,2) default 0 not null '; 
END;