Free Oracle Tips

Oracle Consulting Oracle Training Development

Remote DBA

 

Remote DBA Plans
Remote DBA Service

 
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Internals Magazine
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 


        
 

 Oracle UTL_MAIL Package
Oracle Tips by Burleson Consulting

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by the top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

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 VARCHAR2).

 

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';

DECLARE

 vSender VARCHAR2(30) := 'sender@somewhere.com';

 vRecip  VARCHAR2(30) := 'your.name@domain.com';

 vSubj   VARCHAR2(50) := 'Enter the subject here';

 vMesg   VARCHAR2(4000) := 'Enter the body';

 vMType  VARCHAR2(30) := 'text/plain; charset=us-ascii';

BEGIN

 utl_mail.send

 (vSender, vRecip, NULL, NULL, vSubj, vMesg, vMType, NULL);

END;

/

 

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.

UTL_NLA

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 routine sets.

 

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 time.


Fo
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 Rampant TechPress.

     

Remote DBA Service
 

Oracle Tuning Book

Free Oracle dictionary reference poster

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

North Carolina Oracle Users Group

 

 Arabian horse breeder

Seeing eye horses

 

 

 

 

 

Burleson is the American Team

American Flag

 

 

BC Remote Oracle Support
P.O. Box 511 • Kittrell, NC, 27544

Remote DBA

Remote DBA Services

 

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.