-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCad_Altera Compr Segto Forn.sql
33 lines (28 loc) · 1.33 KB
/
Cad_Altera Compr Segto Forn.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
create or replace procedure consinco.spMrl_AlterComprador(pnNroFornec in MAP_FAMFORNEC.Seqfornecedor%type,
pdDescSegmento in maf_segtofornec.descricao%type,
psApComprador in max_comprador.apelido%type,
pnNroNovoComprador in max_comprador.seqcomprador%type)
is
BEGIN
FOR T IN (SELECT A.SEQFAMILIA, B.SEQCOMPRADOR
FROM MAP_FAMDIVISAO A, MAX_COMPRADOR B, MAP_FAMFORNEC C
WHERE A.SEQCOMPRADOR = B.SEQCOMPRADOR
AND A.SEQFAMILIA = C.SEQFAMILIA
AND C.SEQFORNECEDOR = pnNroFornec
AND C.NROSEGFORNEC in
(select w.nrosegfornec
from maf_segtofornec w
where w.descricao in (pdDescSegmento))
--AND C.PRINCIPAL = 'S' Ticket 101773 - 05/09/2022 - Solicitação Paloma
AND A.SEQCOMPRADOR IN
(select D.seqcomprador
from max_comprador D
where D.Apelido in (psApComprador)))
loop
update map_famdivisao u
set u.seqcomprador = pnNroNovoComprador
where u.seqcomprador = t.seqcomprador
and u.seqfamilia = t.seqfamilia;
end loop;
commit;
end spMrl_AlterComprador;