SELECT
 (T_SAL.MatriculeSalarie || ' ' || NVL(T_SAL.Nom, ' ') || ' '  || NVL(T_SAL.Prenom, ' ') ) as Col1,
  'Portabilité prévue du ' || TO_CHAR(T_HST_INFOSSOCIETE.DateDepart) || ' au ' || TO_CHAR(Add_months(T_HST_INFOSSOCIETE.DateDepart, 9)) as Col2
FROM
  T_PAI,
  T_SAL
  LEFT OUTER JOIN T_HST_INFOSSOCIETE ON T_HST_INFOSSOCIETE.NumSalarie=T_SAL.SA_CompteurNumero AND T_HST_INFOSSOCIETE.InfoEnCours=1
  LEFT OUTER JOIN T_HST_ETABLISSEMENT ON T_HST_ETABLISSEMENT.NumSalarie=T_SAL.SA_CompteurNumero AND T_HST_ETABLISSEMENT.InfoEnCours=1                  
Where   (     (CURRENT_TIMESTAMP >= NVL(-%NbJoursAvant%,0) + Add_months(T_HST_INFOSSOCIETE.DateDepart, 9)
		       and CURRENT_TIMESTAMP <= NVL(%NbJoursApres%,0) + Add_months(T_HST_INFOSSOCIETE.DateDepart, 9) ) 
           and ( T_HST_ETABLISSEMENT.PortabiliteCouverture = 1 and T_HST_ETABLISSEMENT.EtatPaieComplementaire = 2)
        )   
Order by T_SAL.MatriculeSalarie
