SELECT DISTINCT APAYER_VIR_DETAILS.NUM_OV,
  SUM(APAYER_VIR_DETAILS.APAY_MONTANT)             AS MONTANT,
  (APAYER_VIR_DETAILS.APAY_DATE)                   AS DATE_PAYEM,
  MANDAT.MAND_LIBELLE                              AS BENEFICIAIRE,
  1                                                AS NOMBRE,
  SUBSTR(APAYER_VIR_DETAILS.APAY_NUM_COMPTE, 1, 5) AS MODE_OP
FROM APAYER_VIR_DETAILS,
  TIERS,
  MANDAT,
  TITRE
WHERE (APAYER_VIR_DETAILS.TIER_CODE = TIERS.TIER_CODE)
AND TITRE.NUMERO_TITRE              = APAYER_VIR_DETAILS.APAY_TITRE
AND MANDAT.MAND_NUM_INFO            = TITRE.MAND_NUM_INFO
AND APAYER_VIR_DETAILS.NUM_OV      IS NOT NULL
AND APAYER_VIR_DETAILS.APAY_DATE BETWEEN :P_DATE_DEBUT AND :P_DATE_FIN
GROUP BY APAYER_VIR_DETAILS.NUM_OV,
  MANDAT.MAND_LIBELLE,
  SUBSTR(APAYER_VIR_DETAILS.APAY_NUM_COMPTE, 1, 5),
  APAYER_VIR_DETAILS.APAY_DATE
ORDER BY APAYER_VIR_DETAILS.NUM_OV,
  APAYER_VIR_DETAILS.APAY_DATE