Sender: tcross@tiger.rapttech.com.au
Newsgroups: comp.databases.oracle.server
Subject: Re: sending an email from a table trigger (before inserting row)
References: <be0irt$9b1$1@unbe.sarenet.es>
From: Tim X <timx@spamto.devnul.com>
Reply-To: timx@spamto.devnul.com
Date: 07 Jul 2003 18:24:17 +1000
Message-ID: <871xx2d9se.fsf@tiger.rapttech.com.au>
Lines: 25
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: ppp597.nsw.padsl.internode.on.net
X-Trace: duster.adelaide.on.net 1057565404 ppp597.nsw.padsl.internode.on.net (7 Jul 2003 17:40:04 +0950)
Path: newssvr20.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!news-out.superfeed.net!propagator2-maxim!news-in-maxim.spamkiller.net!snewsf0.syd.ops.aspac.uu.net!news1.optus.net.au!optus!news.mel.connect.com.au!news.ade.connect.com.au!duster.adelaide.on.net!not-for-mail
Xref: newssvr20.news.prodigy.com comp.databases.oracle.server:237040

>>>>> "Jon" == Jon  <aaa@bbb.ccc> writes:

 Jon> I would like to know if it is posible to create a table trigger
 Jon> (before inserting a row) so I can send an email directly from
 Jon> the trigger after doing some checking to the data that is going
 Jon> to be inserted. thanks

Yes, you CAN do it, but don't. 

1. sending mail can be a slow operation and this could be a severe
   bottleneck to performance.
2. What happens if the insert is rolled back - you cannot rollback the
   e-mail. 

Either write the info to a table and then have a job (DBMS_JOB?)
periodically query this table and send the e-mail and remove the row
or possibly just create a dbms job and have it send the e-mail.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
