Save the output of the query into a clob variable, then add this as the attachment
e.g. something along the lines of:
begin
  select ...
  bulk collect into attach_recs
  from ...
  
  for 1 in 1 .. attach_recs.count loop
    attachment := attachment || attach_recs ( i );
  end loop;
  mail_id := apex_mail.send ...
  apex_mail.add_attachment ( mail_id, attachment, 'filename' );
end;