1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| select distinct tp.libl "Libelle de la modalite",
ADREINDI(indiv.indi,'L') "adresse",
p.d "Numéro dossier social",
indiv.nom "Nom",
indiv.pren "Prenom",
pr.liblexte "Libelle du produit",
pr.prod "code_produit",
case when(pr.prod='KCTP') then par.vale||'%' else par.vale end "Valeur_modalite"
from pari par
join typp tp on tp.id=par.id_typepara and (tp.ty='zz13' or tp.ty='zz01')
join inte i on i.inte=par.inte
join produi pr on pr.id=i.id_prod and ((pr.prod like 'KC1%' and (pr.prod <> 'KC1ZM' and pr.prod <> 'KC1JM' and pr.prod <> 'KC1YM')) or pr.prod = 'HACTP' )
join AP app on app.appo=i.appo
join inds p on p.dsoc=i.doss and p.INDSPRIN='O'
join indi indiv on indiv.indi=p.indi and indiv.dece='N'
where ((to_char(par.datefin_effe,'J')- to_char(sysdate,'J')<:Nbjour_avant_fin ) and to_char(par.datefin_effe,'J') - to_char(sysdate,'J')>0) or ((to_char(i.datefin_init,'J')- to_char(sysdate,'J')<:Nbjour_avant_fin ) and to_char(i.datefin_init,'J') - to_char(sysdate,'J')>0)
group by p.dsoc, indiv.nom, indiv.pren, pr.prod, pr.liblexte, tp.libl, par.vale,ADREINDI(indiv.indi,'L')
order by pr.prod |
Partager