Skip to Main Content
Learning Oracle PL/SQL
book

Learning Oracle PL/SQL

by Bill Pribyl, Steven Feuerstein
November 2001
Beginner content levelBeginner
424 pages
11h 11m
English
O'Reilly Media, Inc.
Content preview from Learning Oracle PL/SQL

8.3. Receiving Email Inside the Database

In some applications, it's also important to be able to receive an email, process it in some fashion, and load some or all of its contents into the database. For example, a book publisher may send out a specially-formatted email message every week containing a schedule of their upcoming releases, and a library might want to load that information and make it available in their database.

8.3.1. What Are My Options?

While Oracle built-ins like UTL_TCP exist that could make it possible to receive email completely inside a stored procedure, I doubt that many of us would really want to go to that much trouble. Here is the general scenario I have in mind:

  1. Create a special email address on a convenient mail server.

  2. If the mail server isn't the same machine as the database server, use a program like GNU fetchmail that will pull the mail down to the local machine.

  3. Now that the mail data is available in a mail file on the local machine, use one of a variety of techniques to load the email data from the file into the database.

Techniques for loading data from a file into the Oracle database (step 3) include:

SQL*Loader

A command-line utility that uses a programmer-supplied "control file" describing the contents of the data file

External tables (as of Oracle9i)

A way to store this "control file" information in the database itself, enabling query of the data file in a manner similar to a regular table

UTL_FILE

A PL/SQL built-in package that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Oracle PL/SQL

Learning Oracle PL/SQL

Darryl Hurley
Oracle PL/SQL Programming, Third Edition

Oracle PL/SQL Programming, Third Edition

Steven Feuerstein, Bill Pribyl

Publisher Resources

ISBN: 0596001800Supplemental ContentCatalog PageErrata