Sending Email by Oracle Alert when no rows returned
Hello All,
I am having one problem.
In the Oracle Alert i wrote one query which is returing 0 rows.
But sometimes it will returns some rows.
And my requirement is that when this query doesn't return any rows , i want to send one email to user that there is no data
and if the data is present then i have to send the data.
But currently there is no data so i made one Oracle Alert and when i am running that Alert then it is showing me a one message and mail doesn't sent
Oracle Alert did not perform the summary action "My Test Alert" because no exceptions were returned for this action set.
Please Suggest
Thanks & Regards
Write a second alert that fires near about the same time.
select 'send email'
from dual
where 0 = (select count(1) from your_table)
This alert will send a "no rows found" email.
Hope this helps,
Sandeep Gandhi
Similar Messages
-
ACL error when sending email from Oracle 11g
Hi,
It returned something like "error...ACL security" when I tried to send email from Oracle 11g. Is there any security thing that I need to release in Oracle 11g? I used to send emails from Oracle 10g and didn't find any problem.
Thanks.
AndyIn Database 11g Oracle introduced Network Access Control Lists (ACLs) to protect the database from users using the many internet-capable packages such as UTL_INADDR, UTL_HTTP, UTL_TCP, etc.
Read all about it in the docs and look at the code demos here:
http://www.morganslibrary.org/library.html
under DBMS_NETWORK_ACL_... -
How to sending email from Oracle 6i(Forms)
How can I send email from Oracle Forms(6i).
I need to send email to a distribution list(multiple email addresses).send email of multiple email address
[email protected],[email protected],[email protected]
create or replace function mailout
(sender in varchar2,
recipient in varchar2,
ccrecipient in varchar2,
subject in varchar2,
message in varchar2) return number
is
crlf varchar2(2) := chr(13)||chr(10);
connection utl_smtp.connection;
mailhost varchar2(50) := 'Add email server Ip Address here';
header varchar2(4000);
v_num number :=1;
str number:=0;
email varchar2(50);
begin
connection := utl_smtp.open_connection(mailhost,25);
header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
'From: '||sender||' '||crlf||
'Subject: '||subject||crlf||
'To: '||recipient||crlf||
'Cc: '||ccrecipient||crlf||message;
utl_smtp.helo(connection,mailhost);
utl_smtp.mail(connection,sender);
utl_smtp.rcpt(connection,recipient);
while (instr(ccrecipient,',',1,v_num)>0) loop
email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
dbms_output.put_line(email);
utl_smtp.rcpt(connection,email);
str:=instr(ccrecipient,',',1,v_num);
v_num:=v_num+1;
end loop;
utl_smtp.open_data(connection);
-- utl_smtp.write_data(connection,header);
utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
return 0;
exception
when utl_smtp.invalid_operation then
dbms_output.put_line('Invalid Operation in SMTP transaction');
return 1;
when utl_smtp.transient_error then
dbms_output.put_line('Temporary problem with sending email ');
return 2;
when utl_smtp.permanent_error then
dbms_output.put_line('Permanent problem with sending email ');
return 3;
end; -
How to sending email from Oracle Forms
How to sending email from Oracle 6i(Forms)
I need to send email to a distribution list(multiple email addresses).send email of multiple email address
[email protected],[email protected],[email protected]
create or replace function mailout
(sender in varchar2,
recipient in varchar2,
ccrecipient in varchar2,
subject in varchar2,
message in varchar2) return number
is
crlf varchar2(2) := chr(13)||chr(10);
connection utl_smtp.connection;
mailhost varchar2(50) := 'Add email server Ip Address here';
header varchar2(4000);
v_num number :=1;
str number:=0;
email varchar2(50);
begin
connection := utl_smtp.open_connection(mailhost,25);
header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
'From: '||sender||' '||crlf||
'Subject: '||subject||crlf||
'To: '||recipient||crlf||
'Cc: '||ccrecipient||crlf||message;
utl_smtp.helo(connection,mailhost);
utl_smtp.mail(connection,sender);
utl_smtp.rcpt(connection,recipient);
while (instr(ccrecipient,',',1,v_num)>0) loop
email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
dbms_output.put_line(email);
utl_smtp.rcpt(connection,email);
str:=instr(ccrecipient,',',1,v_num);
v_num:=v_num+1;
end loop;
utl_smtp.open_data(connection);
-- utl_smtp.write_data(connection,header);
utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
return 0;
exception
when utl_smtp.invalid_operation then
dbms_output.put_line('Invalid Operation in SMTP transaction');
return 1;
when utl_smtp.transient_error then
dbms_output.put_line('Temporary problem with sending email ');
return 2;
when utl_smtp.permanent_error then
dbms_output.put_line('Permanent problem with sending email ');
return 3;
end; -
I'm sending email in Oracle 11g with apex_mail.send function. I have below html structure. I have added style for table in this html. but when i open received email, style is not applied to the table. only text is visible.
How can i solve this ?
<html>
<head>
<style>table{border-collapse:collapse;}table,td,th{border:1px solid grey;}td,th{padding:5px;}</style>
</head>
<body>
<table width="100%">
<tr>
<th scope="col">Company</th>
<th scope="col">Amount</th>
<th scope="col">Reference</th>
<th scope="col">Note</th>
</tr>
<tr>
<td>HNB</td>
<td>226</td>
<td>..952</td>
<td>Insurance payment.</td>
</tr>
<tr>
<td>AC</td>
<td>2150</td>
<td>..255</td>
<td>A/C service.</td>
</tr>
</table>
</body>
</html>Hello,
Which e-mail client you are using to open e-mail?
If it's MS Outlook 2007 or later, then MS Outlook uses MS Word rendering engine to render HTML. So try to save your HTML into some local file and open it using MS Word. Then you will understand how it;s rendering. Make changes whatever you want using MS word and then use generated HTML to send in e-mail.
If it's MS Outlook 2003 or earlier, then MS Outlook uses IE to render, then you have to repeat above step from IE.
If it's some-other client, please refer their documentation on how they render HTML.
Helpful Links: Microsoft Outlook 2007 Report | Email Standards Project
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
Regards,
Hari -
Cannot send email from pop account when in 3G, will send in WIFI
I cannot send email from pop account when in 3G, will send in WIFI.
I thought it was the SMTP server first.. but when i config my WIFI, suddenly the emails that i tried to send, left my outbox and sent.
Any idea'sThe SMTP server you are using with Wi-Fi would be the outgoing server of your internet service provider... this is likely why that's working.
SMTP servers specific to a ISP would not work on the 3G network. You would probably need another SMTP server. One from your cell provider? -
Since ios5, i cannot send email from my iPod when in my network, only when 3G
Since ios5, i cannot send email from my ipad when wi-fi but only when 3G
The SMTP server you are using with Wi-Fi would be the outgoing server of your internet service provider... this is likely why that's working.
SMTP servers specific to a ISP would not work on the 3G network. You would probably need another SMTP server. One from your cell provider? -
Sending Attachments using Oracle Alerts
Hi All,
I am working on Oracle Alerts. I have to send an output of the report to the client, is it possible to send using Oracle Alerts.
Thanks in Advance,
Venky.Hi,
To send attachments using Oracle Alert, you can follow below mentioned steps:
1) While defining Oracle alert Action, Select 'Action Level' as 'Summary'
2) In Action Details, select 'Action Type' as 'Operating System Script'
3) Select 'Text' radio button
4) Write following code : uuencode <Name of the file along with the path> <Name of the attachment in the mail>|mailx -c &cc_mail_id,&to_mail_id -s "<Subject of the Mailer>" &to_mail_id.
5) You can use mail or sendmail command also instead of mailx command.
6) Save Alert details
Thanks and regards,
Indira -
I can't send emails from my phone when I'm abroad. How can I change that?
I can't send emails from my phone when I'm abroad. How can I change that?
try to log into your email from another mobile or device and see if you can, or log out of your email on your phone and log back in see if it works
-
Problem with Top N Query when no rows returned (takes forever)
I have a table with 100 Million rows and I want to get the latest N records using:
SELECT * FROM
(SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
WHERE rownum <= N;
This works fine and is very fast when there are rows with columnA= 'ABC' but when there are no rows with columnA= 'ABC' the query takes forever.
The strange things is that the inner query returns immediately when run on it's own when no rows with columnA= 'ABC' exist e.g.
SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC
So why does it take for ever for to run:
SELECT * FROM (no rows inner query) WHERE rownum <= N;
I have also tried using:
SELECT * FROM
(SELECT columnA, rank() over(ORDER BY TIME DESC) time_rank
FROM tablename WHERE columnA='ABC')
WHERE time_rank <= N;
which returns instantly when there are now rows but takes much longer than the first query when there are rows.I cannot see a real difference:With histogram we can see a difference on the elapse when no row returned and into explain plan.
SQL> drop table tablename
2 /
Table dropped.
Elapsed: 00:00:00.03
SQL>
SQL> create table tablename
2 as
3 select sysdate - l time
4 , decode(trunc(dbms_random.value(1,10)),1,'ABC',2,'DEF',3,'GHI',4,'JKL','MNO') as columnA
5 from (select level l from dual connect by level <= 1000000)
6 /
Table created.
Elapsed: 00:01:19.08
SQL>
SQL> select columnA,count(*) from tablename group by columnA
2 /
COL COUNT(*)
ABC 110806
DEF 111557
GHI 111409
JKL 111030
MNO 555198
Elapsed: 00:00:05.05
SQL>
SQL> create index i1 on tablename(time)
2 /
Index created.
Elapsed: 00:00:34.08
SQL>
SQL> create index i2 on tablename(columna)
2 /
Index created.
Elapsed: 00:00:30.08
SQL>
SQL> exec dbms_stats.gather_table_stats(user,'TABLENAME',cascade=>true)
PL/SQL procedure successfully completed.
Elapsed: 00:01:18.09
SQL>
SQL> set autotrace on explain
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
TIME COL
17/09/06 ABC
12/09/06 ABC
08/09/06 ABC
07/09/06 ABC
25/08/06 ABC
22/08/06 ABC
13/08/06 ABC
08/07/06 ABC
14/06/06 ABC
01/05/06 ABC
10 rows selected.
Elapsed: 00:00:01.04
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=2364 Card=200000 Bytes=2400000)
3 2 SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
4 3 TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
SQL>
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'MNO' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
TIME COL
20/09/06 MNO
19/09/06 MNO
16/09/06 MNO
14/09/06 MNO
13/09/06 MNO
10/09/06 MNO
06/09/06 MNO
05/09/06 MNO
03/09/06 MNO
02/09/06 MNO
10 rows selected.
Elapsed: 00:00:02.04
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=2364 Card=200000 Bytes=2400000)
3 2 SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
4 3 TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
SQL>
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'PQR' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
no rows selected
Elapsed: 00:00:01.01
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=2364 Card=200000 Bytes=2400000)
3 2 SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
4 3 TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
SQL> set autot off
SQL>
SQL> EXECUTE DBMS_STATS.GATHER_TABLE_STATS(user,'TABLENAME',METHOD_OPT => 'FOR COLUMNS SIZE 250 columna')
PL/SQL procedure successfully completed.
Elapsed: 00:00:09.08
SQL>
SQL> set autotrace on explain
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
TIME COL
17/09/06 ABC
12/09/06 ABC
08/09/06 ABC
07/09/06 ABC
25/08/06 ABC
22/08/06 ABC
13/08/06 ABC
08/07/06 ABC
14/06/06 ABC
01/05/06 ABC
10 rows selected.
Elapsed: 00:00:01.03
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1434 Card=10 Bytes=120)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=1434 Card=110806 Bytes=1329672)
3 2 SORT (ORDER BY STOPKEY) (Cost=1434 Card=110806 Bytes=1329672)
4 3 TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=110806 Bytes=1329672)
SQL>
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'MNO' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
TIME COL
20/09/06 MNO
19/09/06 MNO
16/09/06 MNO
14/09/06 MNO
13/09/06 MNO
10/09/06 MNO
06/09/06 MNO
05/09/06 MNO
03/09/06 MNO
02/09/06 MNO
10 rows selected.
Elapsed: 00:00:02.05
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=6219 Card=10 Bytes=120)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=6219 Card=555198 Bytes=6662376)
3 2 SORT (ORDER BY STOPKEY) (Cost=6219 Card=555198 Bytes=6662376)
4 3 TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=555198 Bytes=6662376)
SQL>
SQL> SELECT * FROM
2 (SELECT * FROM tablename WHERE columnA= 'STU' ORDER BY TIME DESC)
3 WHERE rownum <= 10
4 /
no rows selected
Elapsed: 00:00:00.00
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=12)
1 0 COUNT (STOPKEY)
2 1 VIEW (Cost=6 Card=1 Bytes=12)
3 2 SORT (ORDER BY STOPKEY) (Cost=6 Card=1 Bytes=12)
4 3 TABLE ACCESS (BY INDEX ROWID) OF 'TABLENAME' (Cost=5 Card=1 Bytes=12)
5 4 INDEX (RANGE SCAN) OF 'I2' (NON-UNIQUE) (Cost=4 Card=1)
SQL> Nicolas. -
Sending Email via oracle to an Ooutlook shared Mailbox
I am attempting to send email from an access database using VB to an OUtlook shared mailbox and the email does not get sent. It does not generate an error message but the mailbox never receives the email. The email functionality works fine when sending to a private mailbox in Outlook using the same code. Here is what I am attempting to do:. Does anyone know if there is a setting within the shared mailbox that is preventing the email to be sent?
Public Function Send_Oracle_Email(Recipient_Emails As String, Email_Subject As String, Email_Message As String) As Double
'MsgBox "test"
On Error GoTo Send_Oracle_Email_Error
Dim strConn As String
Dim strCMD As String
Dim oConn As New ADODB.Connection
Dim cmdCommand As New ADODB.Command
Dim rsADO As New ADODB.Recordset
Dim intIndex As Integer
Dim strSentFrom As String
Dim objPara As ADODB.Parameter
' define the connection settings to the server
strConn = "DSN=CSD_PO_PMIS_BUS;Uid=csdmgr
'strConn = "DSN=CSD_PO_PMIS_trash;Uid=csdmgr
If IsMissing(Sent_from) Or Len(Trim(Sent_from)) < 3 Then Sent_from = "[email protected]"
' create and open a connection to the server
Set oConn = New ADODB.Connection
With oConn
.ConnectionString = strConn
.CursorLocation = adUseServer
.Mode = adModeRead
.open
End With
'define the command to be sent to the server
strCMD = "CSDMGR.PRC_SEND_EMAIL"
' create the command and it's provide it's settings
Set cmdCommand = New ADODB.Command
With cmdCommand
.ActiveConnection = oConn
.CommandText = strCMD
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("Sender", adVarChar, adParamInput, 2000, Sent_from)
.Parameters.Append .CreateParameter("recipient", adVarChar, adParamInput, 2000, Recipient_Emails)
.Parameters.Append .CreateParameter("p_subject", adVarChar, adParamInput, 2000, Email_Subject)
.Parameters.Append .CreateParameter("message", adVarChar, adParamInput, 2000, Email_Message)
End With
'execute the command
Set rsADO = cmdCommand.Execute
'show the parameters after the call. The output parameters now how the values returned by the Stored Procedure!
'For intIndex = 0 To cmdCommand.Parameters.Count - 1
' Debug.Print cmdCommand.Parameters(intIndex).Name,
'cmdCommand.Parameters(intIndex).Value
'Next intIndex
'clean up
If cmdCommand.CommandType = adCmdText Then
If Not rsADO.EOF Then
rsADO.Close
End If
End If
oConn.Close
Set objPara = Nothing
Set cmdCommand = Nothing
Send_Oracle_Email = 0
Exit Function
Send_Oracle_Email_Error:
Send_Oracle_Email = Err.Number
'MsgBox Err.Description
Exit Function
End FunctionI am attempting to send email from an access database using VB to an OUtlook shared mailbox and the email does not get sent.I guess I missed the part where Oracle is involved with your problem.
-
Hi Guys,
I have a school project and i have to send an email via Oracle 10g database. I have read and tried a lot of codes but, non of them worked. Some infos says, install Java VM, JServer, JAccelerator, port 25, $ORACLE_HOME...... etc. Can anyone tell me what steps should i follow to send an email. Please i am very confused. I can't do it. I am new too. Also, i am not sure that my computer and oracle 10g needs any extra installation and configuration.
ThanksHi,
I cannot install JServer and i have just checked that "C:\oraclexe\app\oracle\product\10.2.0\server\RDBMS\ADMIN" path doesn't include "initjvm" file.
I tried to install Jserver with following "http://www.orafaq.com/faq/how_does_one_install_the_oracle_jserver_option" link.
I have Java VM installed in my computer.
When i install Oracle 10g, i have given "SYSTEM" as user name and "123456" as passw.
What else can i do to enable Java things for utl_smtp.
Thanks -
Cannot send email from bigpond account when using overseas telco network
I am sure this question has been asked and answered before but I cannot find a definitive answer on this forum I am on the Telstra network locally but when I travel to Malaysia I use a local SIM card with data, as the rates are much cheaper than anything Telstra can matchI find I can receive emails on my bigpond email account but cannot send. Can someone from Telstra publish something in this forum or on the general Telstra help pages on what settings to use exactly so that you can send and receive emails from your bigpond account while using another network overseas. I have tried changing the outgoing mail server account to the local network provider's but I am still unable to send Thanks
Hi Mazzi,
When travelling overseas you can access your BigPond mailbox through an email program, or via the BigPond Webmailhttp://messaging.bigpond.com/inbox.do or http://webmail.bigpond.com/webedge/do/oldlogin. If you choose to use an email program, some settings will need to be adjusted, as mentioned below.
While there are no 'perfect' settings which will work every time and from every country, it may as simple as adjusting the Authentication on the outgoing mail server.
If you are accessing the internet via another Internet Service Provider (ISP), but want to send email through our outgoing mail server using your BigPond email address, then you must activate SMTP authentication. For the purposes of this, think of an 'SMTP (Simple Mail Transfer Protocol) server' as the outbound mail server.
Make sure that you have adjusted the outgoing port settings as listed below, or configure your mail client so that it uses the service provider's SMTP server, with SMTP Authentication disabled. If you are uncertain on what this is, you can usually search for this online, or alternatively contact the service provider that is providing your internet access.
If you are uncertain which mail platform you are on, you can confirm this by logging in here.
The complete list of email settings (including IMAP for Outlook.com accounts) can be found here.
Should you require immediate assistance while overseas, our BigPond Technical Support Team are available 24 hours, 7 days a week via Live Chat
-
Sending Attachments in oracle alerts
Hi All,
I have a requirement where i need to send the output in attachment through mail using Oracle alerts.
Please help.
Thanks in advance,
Gurpreet
Edited by: 880391 on Feb 10, 2012 3:46 AMThe only way you are going to be able to do this is by migrating Alerts to BI Publisher. I've done this recently and I'm starting to document the process here http://oracleapps.smythe.net.au/?q=node/36
-
Unable to receive/send emails from my iPhone when away from home.
I have been unable w/ in the past week or so to send emails from my iphone once I am away from my house, if I am home there is no problem because it jumps onto my wireless but outside it wont let me I have always been able to until lately.
What should I check, where should I go, what should I do, who should I call?????Allan Sampson wrote:
How often do you power your iPhone off and on, and when was the last time you did a Reset?
It is a good idea to power a GSM smart phone off/on on a daily basis - I do so first thing each morning, and I usually do a Reset once a week or so, which seems to help get rid of any cobwebs so to speak.
Alan:
A little bit OT, but can you enlighten me what the difference between a cold start (powering off once a day) and a reset is? On a desktop computer, there is no difference, at least in terms of clearing the "cobwebs."
Thanks,
-dan
Maybe you are looking for
-
How to deal with the barcode?
i'm developing a file storage system in java, there're two barcode on each file(one is pdf417, the other one is code128) , but now ,there's a problem confused me : i use the barcode scanner to scan the file and get images of these files from the scan
-
How to change my meteo localisation on Siri ?
Hi everyone, I have a problem with Siri, when I ask him "What will be the weather tomorrow" for example, he doesn't give me the right weather forcast. It's not my localisation, but he gets the right time. how can I fix it ? I hope someone can help me
-
Hello to all, Within my corporate environment, we have a case where an email account to be used by several people, type a group, like committee, and when one would use this account was recorded who sent this email, within the capabilities of GroupWis
-
Connetion of BI 7.0 to external oracle 10G R2 database system
Dear Experts, We have BI 7.0 system with MS SQL server as database and we want to connect it to database Oracle 10G R2.For that we followed the following procedure. 1) In order to connect to the enterprise database, Oracle 10gR2 client (runtime optio
-
Dreamweaver / PHP cannot view a picture
I have the code set to load and retrieve pictures when editing a product. In the code below you don't see the picture; it's not loading onto the webpage. The field named picture in the MQSQL Database has the name of the file that is on the webserver