email HTML of SQLPLUS

Oracle Version: 11.2.0.4.0

OS: SunOS

Hello guys, I am trying to send an HTML email to outlook from sqlplus, that I wrote a script similar to the one below.

Here's where I'm stuck. My developer comes to me and asks me that the email must come only if the sql returns data. If the SQL returns null then the enamel would not come. I don't know how to implement this requirement. I checked some blogs but not mention how to implement this requirement in this scenario.

If my developer wants just an HTML attachment, then it would have been easier, but he wants to view this report in the body of the email itself.

Thank you

set echo off numf 999G999G999G999 lin 32000 trims on pages 50000 head on feed off markup html off
alter session set nls_numeric_characters='.''' nls_date_format='Day DD. Month, YYYY';
spool /tmp/rep.html
prompt To: [email protected]
prompt From: [email protected]
prompt Subject: Daily department report
prompt Content-type: text/html
prompt MIME-Version: 1.0
set markup html on entmap off table 'BORDER="2" BGCOLOR="pink"'
prompt <i>Good morning, </i>
prompt <i>Here is the department report per &_DATE</i>
prompt <i>Kind Regards, </i>
prompt <i>Your IT Operations</i>

prompt <br/><h3>List of departments with the total salaries of their employees</h3>
select dname "Department", sum(sal) "Salary" from emp join dept using (deptno) group by rollup(dname);
spool off
host /usr/sbin/sendmail -t </tmp/rep.html
quit

The problem is that SQL * Plus has no direct conditional construction (e.g. not if THEN ELSE order).

There are several possible solutions, like using an anonymous plsql or make conditional coil block (as I call it).

In your case it should wrap the host of sendmail command in some files, based on the results of the selection. Then run this file.

+ untested example +.

Instead of ".host /usr/sbin/sendmail -t

You would do:

coil doSendMail.go

Select '/usr/sbin/sendmail -t

Ofemp join dept using (deptno)

where rownum = 1;

spool off

Home doSendMail.go

If the select does not return a line, you would get a no line found message. If the feedback is removed this message may not even make it in the hold file. Then, you must run the hold file do nothing.

Tags: Database

Similar Questions

  • BlackBerry Passport email Html appears in the Hub on Blackberry Passport

    Dear Support Forums,

    I have recently upgraded to a new phone (BlackBerry passport) and have encountered a problem with my email.

    I am not able to display html emails in my inbox on my device. When I saw the same email from my desktop via outlook or webmail it displays very well.
    I can view emails html of my other personal e-mail accounts very well on the device, however, it's just my business email which will not display emails correctly on the device. I jumped through all the hoops support with technical support from my mobile provider and technical support of my corporate email provider already and they have determined that the problem is the end of Blackberry.

    I would like to know if there is something that can be done to help.
    Thank you

    noelgREALTY.

    As temporary (since my last post) I had the account e-mail problem and set up the Activesync for contacts & calendar only (no e-mail) and set up a separate IMAP on the same device for the part by e-mail only. In this configuration, I could get HTML emails as usual, but I lost the functionality to send Calendar invites via ActiveSync.

    I did updates BBOS and whenever have tried turning on the email back for ActiveSync see the updates addressed the issue. I had not checked it lately / after the update so I tried today and voila! My ActiveSync email now displays HTML emails as usual in my problem email account. If all is good now.

  • How to avoid the color address IOS in email HTML Template?

    Hello

    How to avoid the color address IOS in email HTML Template?

    Thank you

    Rahul Bhambri

    Hello Rahul,

    Please use css in your style sheet

    a {[x-Apple - detectors of data]

    color: inherit! important;

    text-decoration: none! important;

    font size: inherit! important;

    Police-family: inherit! important;

    Police-weight: inherit! important;

    line-height: inherit! important;

    }

    Thank you

    edynamic expert Eloqua

  • Email HTML No. on Storm blackBerry Smartphones

    I have the storm, and it does not display the email in html format.  I have the BPS server, as shown below.  can someone tell me how to get html email displayed as much vs the unusable text html?

    Thanks in advance

    Brent

    Status: running
    Host name: SRVBB
    Number of users: 1
    Recipient of the broadcast Messages: 486
    Messages sent: 19
    Data packets pending: 0
    Filter Messages: 0
    Expiry of Messages: 0
    Messages failed: 0
    Active blackBerry MDS connection service: true
    Wireless Message reconciliation enabled: true
    SRP status: connected
    PID: 6900
    BlackBerry Professional Software Version: 4.1.4.3

    The current version of BPS does not support HTML email.  There are other posts that suggest that there is a BPS update in the new year, and which will contain the HTML Help.  But I have yet to see official notice of RIM describing a version or a new service pack.

    The current version of BES supports HTML email.

  • Email html blackBerry Smartphones

    I have a Blackberry 8310 v4.2.2.146 (Platform 2.5.0.16).  While the device works very well, the problem I have is that all my emails are in text format. Earlier, the emails were until the date he took my sys admin and returned with the emails as text in html format. Unfortunately, the guy only has no idea about what he did that made the changes. Can someone guide me on how I can get my emails to the html formats.

    Thank you.

    Your most up-to-date OS 4.5 for the 8310:

    http://www.BlackBerryForums.com/General-8300-Series-discussion-curve/207811-latest-OS-8310-4-5-0-294...

  • Get - vm | Get-vievent email html output

    Hello world

    I am having trouble pushing results table in an object and then adding the members of the object to an array.  I have had success using the slot method in the past, but I've only tried (previously) with a cmdlet.  In the example below, I'm piping several cmdlets.  Basically, $vms outputs very well, but I can't get any instantiated table to fill later.  The $mainArray will always send as null in the email.  Any ideas?  I really don't want to get vievent in the foreach loop, as it will really slow down the query.

    SE connect-viserver test.testdomain.com

    $mainArray = @)

    $userArray = @)

    $timeArray = @)

    $msgArray = @)

    $CDT = get-Date

    $vms = get - VM | Get-VIEvent-Types of information - start $CDT. AddDays(-30)-finishing $CDT | Where {$_.} GetType(). Name - eq "VmBeingDeployedEvent" - or $_. GetType(). Name - eq "VmCreatedEvent" - or $_. GetType(). Name - eq "VmRegisteredEvent"} | Select the username, Createduserid, FullFormattedMessage | Format-Table - AutoSize

    foreach ($vm to $vms)

    {

    $username = $vm. Username

    $createdTime = $vm. Createduserid

    $msg = $vm. FullFormattedMessage

    $userArray += $username

    $timeArray += $createdTime

    $msgArray += $msg

    }

    For ($i = 0; $i - lt $userArray.Count; $i ++)

    {

    $item = new-Object PSObject

    $item | Add-Member-type NoteProperty-Name "UserName" - value $userArray [$i]

    $item | Add-Member-type NoteProperty - name "time created" - value $timeArray [$i]

    $item | Add-Member-type NoteProperty-Name 'Message' - value $msgArray [$i]

    $mainArray += $item

    }

    "$Head = @".

    < style >

    TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse ;}}

    TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED ;}}

    TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black ;}}

    < / style >

    "@

    # #begin send e-mail section.

    $comp = get-wmiobject win32_computersystem

    $mailFrom = $comp.name

    $FromAddr = $mailFrom + "@testdomain.com.

    $ToAddr = " " [email protected] "" "

    $Subject = "Virtual machines created in the last 30 days"

    $SMTPServer = "smtp.testdomain.com".

    $Body = $mainArray |  ConvertTo-Html-head $Head | Out-string

    Send-MailMessage-to $FromAddr - to $toAddr - subject $Subject - body ($body) - BodyasHtml - SmtpServer $SMTPServer

    disconnect-viserver-confirm: $false

    Why if complicated, what follows should give the same result.

    SE connect-viserver test.testdomain.com

    $mainArray = @)

    $CDT = get-Date

    $mainArray = get - VM | Get-VIEvent-Types of information - start $CDT. AddDays(-3)-finishing $CDT | Where {$_.} GetType(). Name - eq "VmBeingDeployedEvent" - or $_. GetType(). Name - eq "VmCreatedEvent" - or $_. GetType(). Name - eq "VmRegisteredEvent"} |

    Select @{N = 'Username'; E={$_. User name}}.

    @{N = "time created"; E={$_. Createduserid}},

    @{N = 'Message'; E={$_. FullFormattedMessage}}

    "$Head = @".

    "@

    # #begin send e-mail section.

    $comp = get-wmiobject win32_computersystem

    $mailFrom = $comp.name

    $FromAddr = $mailFrom + "@testdomain.com.

    $ToAddr = "[email protected]".

    $Subject = "Virtual machines created in the last 30 days"

    $SMTPServer = "smtp.testdomain.com".

    $Body = $mainArray |  ConvertTo-Html-head $Head | Out-string

    Send-MailMessage-to $FromAddr - to $toAddr - subject $Subject - body ($body) - BodyasHtml - SmtpServer $SMTPServer

    disconnect-viserver-confirm: $false

  • Email HTML Image base Table Outlook 2077 &amp; 2010

    Hello

    I have seen a few similar questions to mine, tried several fixes suggested without success so far. It's my first html email, made in dreamweaver from photoshop to slice images.

    Anyone would be able to take a look at my Table/Image email based and guide me in the right direction to little ge to display correctly in Outlook 2007 / 2010. I know that Outlook is that pain with emails, but the majority of my recipients will use one of these versions.

    http://www.bwinteriors.com/newsletter/january_newsletter_2.html

    You think that coding is too when you see it, but it's because I was adding all the fixes, everyone gives to think...

    I would really appreciate the help on this one.

    Thank you very much.

    A few other points...

    1 download - the main problem I see for you is default e-mail client settings. The default for most email clients is to not download images embedded in e-mail, so that your recipients won't see anything but your text and the text "click here" unless or until they choose to download. This text needs an update to make it useful.

    2 Images - "All emails image" are considered to be spam by many mail junk/spam filters, it is preferable to have a html text content to prevent it from being blocked by the recipient's e-mail clients. I am not sure that the small amount you currently have is sufficient for most of the filters. That being said, the current email could also trigger some enterprise-level spam filter, keep the email never reach the recipient e-mail client and get all that ' ' the e-mail address you use on the blacklist on the servers of the company.

    3 embedded CSS - Embedded css (css in the)a page) will not work on a wide variety of email clients, it gets deleted as well as most of the othercontent. You can use inline css, although the css is still not supported by many e-mail clients, especially Outlook. It seems that your css will be very well because it is quite simple. He just needs to be moved in the actual email items.

    4 valid Code - apart from that, the code is technically very well except the caps all META, that should be lowercase to line 3, an additional label to line 4 and the use of the attribute height in the table which is technically incorrect, but probably not a problem of display.

  • Gaps/spaces in email HTML in some browsers

    Hello

    I created an HTML email to send to a client.  It looks like Gmail, Outlook, att.net and Hotmail on my PC.  There are gaps present slice marks on Hotmail on my Mac and Yahoo accounts.  Do you know how I can fix these white gaps for accounts yahoo and hotmail on Mac?  See the screen capture below.

    Screen Shot 2012-03-09 at 8.24.07 AM.png

    Try to add display: block; for the src images tag (see example below)

    http://www.whatever.com/images/myimage.jpg"style =" "display: block;" width = "150" height = "150" alt ="" / > "

  • Creating Email HTML messages

    I use DW to create HTML emails that I send to my customers for product update announcements, etc. As you may know, HTML email generally always use many conventions archaic pre - CSS to ensure compatibility, mainly using tables and different deprecated tags to put in shape content rather than attempt to use div tags, etc. And there are other differences of note as having absolute - not! -Links to the images uploaded, etc.

    If someone with experience that can then pass on a few tips? Mainly, I guess I have to turn in the way HTML compatibility level down to be able to insert some of this stuff. In general it is often not even anything in the header part of the message.

    Thank you for everything that you can pass along.

    HTML emails - What you Need to Know?

    http://ALT-Web.com/articles/HTML-emails.shtml

    Creating cross-Client HTML emails in Dreamweaver.
    http://www.Adobe.com/devnet/Dreamweaver/articles/html_emails.html

    Nancy O.

    ALT-Web Design & Publishing

    Web | Graphics | Print | Media specialists

    http://ALT-Web.com/

    http://Twitter.com/ALTWEB

  • Email HTML - link problem

    I've created an HTML email in dreamweaver. It looks great on my Mac and Mac Mail. I sent it and some people on the PC have a blue box around links. Just like those in DreamWeaver when you work on the file. At the point where the slices are irrelevant because same blue line takes place.

    Do you know how to fix this? Thank you very much!!!

    Add "an img {border: none ;}}. (without the quotes) to the stylesheet CSS embedded in the email.

  • EMAIL HTML - CSS the right-of-way?

    What is the best way to add css to a html email?

    I was browsing for free Mail Chimp and Campaign Monitor templates.

    Mail Chimp uses embeded css and template free of Campaign Monitor external style sheets.

    It has always been my impression that style external sheets did not work in of many browsers for example yahoo mail e-mail. However, Campaign monitor seems to be the best on the market, so it can't be bad can it?

    Code:

    < link rel = "stylesheet" type = "text/css href ="screen.css"" > "

    Here is a link to there free patterns of mail electronics html. (PS, they are very professional looking)

    http://www.campaignmonitor.com/templates/

    In my view, inline styles are the best way to go.

  • Email HTML of reports

    I'm sure there's an easy way to do...

    My applications use a lot of email to communicate with customers. So far, we have used plain text, and we'd like to jazz it up a little bit by sending HTML format instead.

    But rather than change the code of all the messages that are currently from PL/SQL functions, I think that we could generate the content that we need through SQL-based reports and get the formatting neat all what is done for nothing. We may have to splice a greetings and a signature. But the main stumbling block, it's that I don't want customers to have to open an attachment when the content can be integrated in the email itself.

    But how do I intercept the html report output and use it as an input parameter to the apex_mail procedure, which is already getting to/from/subject and all other settings he needs existing and must process just this one extra piece of well formatted dynamic content?

    Any suggestions would be welcome, as I had much rather get on with version 4 than handcoding HTML conversion!
    Thanks and greetings
    CS

    Chris,

    Sending HTML content as input of MAIL is simple. All you have to do is pass HTML content in the parameter "p_body_html" to APEX_MAIL. SEND the procedure.

    Using AJAX you can draw dynamically the content of the report.

    See the demo of traction for the region of Carl.
    http://Apex.Oracle.com/pls/OTN/f?p=11933:48

    See you soon,.
    Hari

  • creating email html in muse adobe

    A customer has an existing Web site, and I don't know what software appeared in. They want to make me some HTML invitations and newsletters for ship-can I create in Muse or is there a better product from Adobe for this?

    Thank you

    You will need to use Dreamweaver if you want to use Adobe software.

    You can also use the services of third parties such as Mailchimp with Muse newsletter.

  • How to change the Irecruitment password reset email HTML

    Hi all

    When our candidate request a new password, with the help of forgotten password button, they get the new password with extra space.

    This additional space is originally broadcast when the user to copy and paste the password into the application.

    How can I change the body of the email to renovated spaces?

    I need to change IRC_VIS_NEW_PASSWORD_TEXT?

    Please think!

    951632 wrote:
    Hi all

    When our candidate request a new password, with the help of forgotten password button, they get the new password with extra space.

    This additional space is originally broadcast when the user to copy and paste the password into the application.

    How can I change the body of the email to renovated spaces?

    I need to change IRC_VIS_NEW_PASSWORD_TEXT?

    Please think!

    Please check (users that ask for passwords to be reset, cannot connect using new passwords [282034.1 ID]).

    Thank you
    Hussein

  • Email HTML

    Do you use the Dreamweaver to create XHTML emails? How do you test within the e-mail software?

    Yes, I use DW to create an email.  Accepting emails only tables and no background image I find webpages then sometimes more difficult because emails should be so simple.  I don't test in DW at all well.  I would recommend signing up for the service with companies like Constant Contact or MailChimp for this.

Maybe you are looking for

  • Why my site Iframe is partially loading?

    Dear Sir. IFRAME of my Web site loads partially in firefox, but to load entirely in chrome. You can check http://orthocad.IITB.AC.in/betic/ Please let me know what needs to be done to solve this problem.

  • Satellite A100-847: movies DVD stutter during playback of DVD

    HelloI have a problem when I play movies from DVD or CD sound and video jerky.When I play only HD music, the sound is not clear (virtual sound option is activated) - hear kind of static and the radio... Someone had this kind of problems? How to solve

  • place memory safe table

    Hello. I work with an array of "big", and I would like to know if I'm just doing. I am given concatenation (SGL) on my program and with him, build a larger painting each iteration of the loop. I calculated that I need a table with about 200000 points

  • DISM compatibility

    Hello Can someone tell me if the DISM following the Dism/online/Cleanup-Image commands /CheckHealth, /ScanHealth Cleanup-Image Dism/online and Dism/online/Cleanup-Image /RestoreHealth are supported in Windows Vista and Windows 7 operating system? If

  • How can I see printer photosmart hp 5520

    specifically, my printer prints only when it wants to! It is brand new and so is the computer on the desk.  It says I have 13 things in Quebec City, but I can't find the link to view these docs to see what is there and what, now I need to delete beca