How to send the result of a query via email

1

I wondered if anyone would know how to do this to run the query correctly. I need this to be sent to the email appearing the result that in the case would be Name: Ariel

[select rtstr1 as hostname
   from poldat_view
  where poldat_view.polcod = 'VAR-EXEL'
    and poldat_view.polvar = 'EMAIL'
    and poldat_view.polval = 'SMTP-SERVER'
    and wh_id = '0028'] catch(510, -1403)
|
[select '[email protected]' as to_email
   from dual
 |
        if (@? = 0)
 {
     send email
      where attachment = @file_attachment
        and from = '[email protected]'
        and msg = [select 'Ariel' as Nome from Dual]
        and to = @to_email
        and subject = 'Relatorio Expedição Norditropin'
        and hostname = @hostname
 }

The problem is at the end where we have "and msg = [select 'Ariel' as the Name from Dual]" the email is sent by instead of the query result appears the query itself ([select 'Ariel 'as the Name from Dual]), I already tried to do it in other ways and the expected result did not come up either. I thank everyone for their attention.

    
asked by anonymous 07.06.2017 / 18:22

0 answers