How to send the result of a query via email

Asked

Viewed 708 times

1

I wonder if anyone could tell me how I can perform the below query correctly. I need this to be sent to the email showing 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 Name from Dual]" the email is sent but instead of appearing the result of the query appears the query itself ([select 'Ariel' as Name from Dual])I’ve tried to do it in other ways and I haven’t come up with the expected result either. thank you for your attention.

  • You have to create a cursor and a variable (char) and fill in the variable with the query result. , https://docs.oracle.com/javase/tutorial/jdbc/basics/retrieving.html >

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.