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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| function VALECARAFormula return Char is
cursor d is select cc.codecate, cc.codcarub,cc.titimpde,cc.ordimpde,cc.nb_impde,
c.typcarub
from CATEGORIE_CARACT_RUBRIQUE cc,V_CARACT_RUBRIQUE c
where cc.codcarub = c.codcarub
and cc.codecate = c.codecate
and cc.codecate = :codecate
and nvl(ordimpde,0)<>0
and ( cc.titimpde is not null
or cc.ordimpde is not null
or cc.nb_impde is not null)
order by ordimpde;
x varchar2(2000);
s varchar2(2000);
x_desicara varchar2(100);
rr risque_caract%rowtype;
x_codecara varchar2(5);
begin
x := null;
s := null;
for rd in d loop
x_codecara := substr(rd.codcarub,2);
if substr(rd.codcarub,1,1)='$' then --EFI 070305
begin
select valecara, valecode,
valenume, valedate, valebool, valetext
into rr.valecara,rr.valecode,
rr.valenume,rr.valedate,rr.valebool,rr.valetext
from v_all_risque_caract
where codeinte = :codeinte
and numepoli = :numepoli
and coderisq = :coderisq
and codecara = x_codecara
and ( ( nvl(:p_numeaven ,0) between nvl(avenmodi,0) and numeaven-1) or
( nvl(:p_numeaven ,0) < nvl(avenmodi,0) and nvl(:p_numeaven ,0) = numeaven)
/* or ( nvl(:p_numeaven ,0) > nvl(avenmodi,0) and nvl(:p_numeaven ,0) = numeaven)*/
or nvl(avenmodi, 0) in (select numeaven from avenant
where codeinte = :codeinte
and numepoli=:numepoli
and (numavere = :numeaven or numavera = :numeaven)));
exception
when no_data_found then
rr.valecara := null;rr.valecode := null;
rr.valenume := null;rr.valedate := null;
rr.valebool := null;rr.valetext := null;
end;
x_desicara := null;
x_desicara := libelle_caracteristique (x_codecara,
rr.valenume, rr.valedate, rr.valecode, rr.valebool, rr.valetext);
select decode(rd.typcarub,'V',lpad(ltrim(nvl(x_desicara,'-')),rd.nb_impde)
,'E',lpad(ltrim(nvl(x_desicara,'-')),rd.nb_impde)
,rpad(nvl(x_desicara,'-'),rd.nb_impde))
into x
from dual;
if s is null then
s := x;
else
s := s||'|'||x;
end if;
end if;
--EFI 070305 D
if substr(rd.codcarub,1,1)='§' then
rr.valecara := null;
rr.valecode := null;
rr.valedate := null;
rr.valebool := null;
rr.valetext := null;
rr.valenume := null;
select sum(valerubr) valenume
into rr.valenume
from hist_detail_garantie_accordee r
where r.codeinte = :codeinte
and r.numepoli = :numepoli
and r.coderisq = :coderisq
and r.codecate = rd.codecate
and r.codrubta = x_codecara
and (nvl(:numeaven,0) between nvl(r.avenmodi,0) and r.numeaven -1 or
nvl(:numeaven,0) = nvl(r.avenmodi,0));
x_desicara := null;
x_desicara := libelle_rubrique_prod (x_codecara,
rr.valenume, rr.valedate, rr.valecode, rr.valebool, rr.valetext);
select decode(rd.typcarub,'V',lpad(ltrim(nvl(x_desicara,'-')),rd.nb_impde)
,'E',lpad(ltrim(nvl(x_desicara,'-')),rd.nb_impde)
,rpad(nvl(x_desicara,'-'),rd.nb_impde))
into x
from dual;
if s is null then
s := x;
else
s := s||'|'||x;
end if;
End if;
end loop;
return(s);
end; |