The UTL_MAIL package can be used to send email
to recipients, including CC and BCC addresses.
Because of some security issues, the package is
not installed by default. As sys, two scripts in
the $ORACLE_HOME/rdbms/admin directory must be
run: utlmail.sql and prvtmail.plb. Once
installed, then set the
smtp_out_server parameter in the
initialization parameter file. If not set, a
default value of DB_DOMAIN will be used.
The package contains three procedures: SEND,
SEND_ATTACH_RAW, and SEND_ATTACH_VARCHAR2. The
last two procedures are overloaded. One deals
with VARCHAR2 attachments and the other with
RAW. The only difference between the procedures
is the datatype for ATTACHMENT (RAW versus
To generate many invocations of UTL_MAIL, it is
necessary to loop through addressee information.
Otherwise, the developer would be executing this
package one recipient at a time. Create a table
with recipients, or determine a query which
provides the same information, and loop through
what was selected from the source table to
extract addressee information.
What is different between UTL_MAIL and UTL_SMTP?
The UTL_MAIL package is actually a wrapper over
two other packages: UTL_TCP and UTL_SMTP.
Overall, UTL_MAIL is much easier to use than
UTL_SMTP. In ancient times, UTL_SMTP was
Oracle’s answer to sending email via PL/SQL.
Introduced in 10g, UTL_MAIL is the way to go
because of its overall simplicity.
Here is a simple example of how to send email
using UTL_MAIL. Replace the obvious text prompts
for real data. If one does not know one’s mail
server, send an email to oneself and look at the
header data, or ask the system administrator.
ALTER SYSTEM SET
smtp_out_server = 'mailserver.domain.com';
VARCHAR2(30) := 'email@example.com';
VARCHAR2(50) := 'Enter the subject
VARCHAR2(4000) := 'Enter the body';
VARCHAR2(30) := 'text/plain; charset=us-ascii';
vRecip, NULL, NULL, vSubj, vMesg, vMType,
This example is based on sending email from a PC
using Windows XP. As mentioned, once the mail
package is compiled, the
smtp_out_server parameter can be
set in the SPFILE.
The UTL_NLA package represents the best area of
mathematics: linear algebra! The two major areas
are BLAS (Basic Linear Algebra Subprogram) and
LAPACK (Linear Algebra Package). Within each
area, more divisions are present. The BLAS
subset has three levels (1-3) and LAPACK has two
Use of the package presupposes a working
knowledge of linear algebra. For that matter, if
the developer works with linear algebra,
Eigenvalues, LU decomposition, and so on, he is
probably already working with other tools better
suited to his needs.
For now, observe that Oracle has a highly
complex and intricate math routine built-in that
pertains to a very small set of users. It would
be interesting to see how efficient these
routines are as that is usually the limiting
factor of a program’s utility. Virtually all
routines excel at low order systems but tend to
suffer as the number of systems increases.
Oracle may hold several TPC records for
transaction rates, but it is doubtful it will
ever hold a record for fastest LU decomposition
r more details on Oracle utilities, see the book "Advanced
Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.
You can buy it direct from the publisher for 30% off directly from