Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How ot remove white strings from a date

Hi,

Under Oracle APEX 24 and Oracle 19c, I have an automation process with the following request:

begin
 for rec in (
select date_prochaine_action as max_date_prochaine_action, cci_int.courriel_personnel as courriel_interne, cci_inter.courriel_personnel as courriel_interaction, cih.responsable_interaction,
      cih.responsable_interne, cih.entreprise, cse.entreprises, cih.OBJET_INTERACTION
 from cs_interaction  cih
 left join cs_contact_interne    cci_int
   on cih.responsable_interne = cci_int.id
 left join cs_contact_interne    cci_inter
   on cih.responsable_interaction = cci_inter.id
 left join cs_entreprise         cse
   on cih.entreprise = cse.id
-- where cih.date_prochaine_action < current_date AND CIH.PROCHAINE_ACTION <> 3
 where  CIH.PROCHAINE_ACTION <> 3
group by cih.date_prochaine_action, cih.responsable_interaction, cih.responsable_interne, cih.entreprise, cci_int.courriel_personnel, cci_inter.courriel_personnel,cse.entreprises, cih.OBJET_INTERACTION 
 ) loop
   apex_mail.send(
     p_to      => rec.courriel_interne || ',' || rec.courriel_interaction,
     p_from    => 'mailsender@dummydomain.com',
     p_body    => 'Bonjour,' || chr(13) || chr(13) ||
                  'La date d''action pour l''entreprise ' || rec.entreprises || ' est dépassée.' || chr(13) || chr(13) ||
                  'La date prévue de l''action était le : '|| REPLACE ( TO_CHAR(rec.max_date_prochaine_action, 'DD Month YYYY') , '  ', ' ')|| '.' || chr(13) || chr(13) ||
                  'Objet de l''interaction : ' || rec.OBJET_INTERACTION || chr(13) || chr(13) || 
                  'CSC' || CHR(13) || CHR(13) ||
                  'Ne pas répondre à ce courrier, il ne sera pas traité.' || CHR(13) || CHR(13),
     p_subj    => 'Notification de dépassement de date d''action'
   );
 end loop;
APEX_MAIL.PUSH_QUEUE;
end;

The date displayed contains extrat white characters:

REPLACE ( TO_CHAR(rec.max_date_prochaine_action, 'DD Month YYYY') , ' ', ' ')|| '.'

I woul like only one space between each word. But I get as a result: 01 Mai 2026.

I would like to get: 01 Mai 2026.

PS: If a run this command in SQL Worksheet, the result is as expected:

Best regards.

This post has been answered by Gerrit van der Linden on May 1 2026
Jump to Answer
Comments
Post Details
Added on May 1 2026
2 comments
111 views