Tenho o CPF sem DAC, e necessito atualizar uma tabela, com base nele, já com o DAC.
os passos são esses:
1º
CURSOR c1
IS
select cpf_icg,id
into vCPF,vID
from tkt_261064;
CURSOR c2
IS
select max (dev_cpf)
into vCPF_DAC
from devedor
where dev_pro_cod = 'ICG'
and dev_cpf like vCPF || '%'
group by dev_cpf;
Após isto, ele faz um update numa coluna da tabela do cursor 1.
update tkt_261064 i set i.cpf_com_dac=vCPF_DAC where i.cpf_icg= substr ('vCPF_DAC',1,12);
Pergunto:
O que estou fazendo errado?
create or replace procedure teste30 is
vCPF varchar2(20);
vCPF_DAC varchar2(20);
vID number(19);
CURSOR c1
IS
select cpf_icg,id
into vCPF,vID
from tkt_261064;
CURSOR c2
IS
select max (dev_cpf)
into vCPF_DAC
from devedor
where dev_pro_cod = 'ICG'
and dev_cpf like vCPF || '%'
group by dev_cpf;
BEGIN
open c1;
LOOP
fetch c1 into vCPF,vID;
end loop;
FOR x IN c2;
loop
update tkt_261064 i set i.cpf_com_dac=vCPF_DAC where i.cpf_icg= substr ('vCPF_DAC',1,12);
close c2;
commit;
end loop;
END;