-- Lucas - Sol. 12506 - Atualização da verba associada para empregada doméstica.
insert into VRHF_EMP_TVSCOL(BDCODVER, BDCODEMP, BDCODCOL, BDANOINIVSCOL, BDMESINIVSCOL, BDDIAINIVSCOL)
select 25 BDCODVER, BDCODEMP, BDCODCOL, 2015 BDANOINIVSCOL, 10 BDMESINIVSCOL, 0 BDDIAINIVSCOL from VRHF_EMP_TVSCOL TVSC
where BDCODVER = 26 and coalesce(BDANOFIMVSCOL, 0) = 0 and coalesce(BDMESFIMVSCOL, 0) = 0 and not exists(select * from VRHF_EMP_TVSCOL where BDCODVER = 25 and BDCODEMP = TVSC.BDCODEMP and BDCODCOL = TVSC.BDCODCOL);

update VRHF_EMP_TVSCOL set BDANOFIMVSCOL = 2015, BDMESFIMVSCOL = 9 where BDCODVER = 26 and coalesce(BDANOFIMVSCOL, 0) = 0 and coalesce(BDMESFIMVSCOL, 0) = 0;

commit work;
