XML Gateway outgoing messages

XML Gateway outgoing messages
select (delivery_timestamp - generation_timestamp) * 24 * 60 generate_to_deliver_minutes,
       generation_timestamp,
       case generation_status
         when '1' then          'Error'
         when '0' then          'Ok'
         else generation_status
       end generation_status,
       generation_message,
       delivery_timestamp,
       case delivery_status
         when '2' then          'Error'
         when '0' then          'Ok'
         else  to_char(delivery_status)
       end delivery_status,
       delivery_message,
       document_id,
       protocol_address,
       out_msgid,
       regexp_replace(protocol_address, '([^/]*)://([^/]+)/(.*)', '\2') domain
  from ecx_out_process_vl o
 order by o.generation_timestamp desc