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 to store multiple values from a select into a variable ?

Hi,

Under Oracle 19 and APEX 24, I want to store multiples values from a select into one variable (TACHES) and send the value of this variable with a mail. This is the code:

DECLARE
TACHES VARCHAR2(4000);
begin
Select 'ID : ' || ID || 'Titre de la tâche : ' || TITRE || CHR(13) || CHR(13) INTO TACHES FROM AD_TACHE WHERE TACHE_TERMINEE = 'Non' ;
APEX_MAIL.SEND(
   p_to                        =>   'unknown@gmail.com',
   p_from                      =>   'unknown@dummydomain.com',
   p_body                      =>  'Tâches non terminées :' 
                                   || CHR(13) || CHR(13) || TACHES 
                                   || CHR(13) || CHR(13) || 'Ne pas répondre à ce courriel, il ne sera pas traité.',
   p_subj                      =>  'Tâches non terminées') ;
end;

When executing this automation on APEX, I get an error :

ORA-01422: Exact extraction returns more than the requested number of rows.

How to do to avoid this error ?

Best regards.

This post has been answered by Varsha Suresh on Mar 2 2026
Jump to Answer
Comments
Post Details
Added on Mar 2 2026
10 comments
173 views