Sie sind auf Seite 1von 3

Alerts

Oracle Alerts is something that can be used to Notify/Alert to one or multiple


persons about an activity or change that occurs in the system. The alerts can also
be used to call a procedure, run some sql script etc.
There are 2 types of alert
1) Periodic Alert
2) Event Alert
Periodic Alerts:
These alerts are trigger periodically, hourly, daily, weekly, monthly etc. based
upon how it is setup to be triggered. When alert runs and the condition (SQL
Query etc.) in the alerts fetches record, then the events specified in the alert are
triggered.
Ex. 1) Daily alert to send notification on the sales order on which credit check
hold is applied for a day
2) Hourly alert to send notification on all the concurrent request that completed
with error
3/If you want to know list of items created on that day at the end of day you can
use periodic alerts repeating periodically by single day. This alert is not based on
any changes to database. This alert will notify you every day regardless of data exists
or not that means even if no items are created you will get a blank notification.
Event Alerts:
These Alerts are fired/triggered based on some change in data in the database.
This is very similar to the triggers written on the table. Unlikely, event alerts can
only fire on After Insert or After Update.
Ex. 1) an alert that sends notification when new item is created.
Ex: If u want to notify your manager when you create an item in the inventory
you can use event based alerts. When you create an item in the inventory it will
create a new record in mtl_system_items_b, here inserting a record in the table
is an event so whenever a new record is inserted it will send the alert. In same
alert you can also send the information related to that particular item.
Uses of Alerts:
1.You can send notifications
2.You can send log files as attachments to notifications
3.You can call PL/SQL stores procedures
4.You can send approval emails and get the results
5.Print some content dynamically

How to create an Alert?


1. Study your Business requirement and decide what type of alert you need either
periodic alert or event based alert.
2. If you are going for periodic alert decide the frequency.

3. If you have chosen event based alert then find out on which event (insert,update,delete) you want to
fire the alert.
4. Decide what data need to be included in the alert.
5. Based on the data you want in the alert write a SELECT SQL statement to pull
the data.
6. Create a distribution list grouping all the people to whom you want to send the
alert.
Just for example, assume a requirement to send Happy birthday mail to employees in an organization.
We have to choose Periodic alert for our requirement.
Employee Birthday can be any calendar day of the year. So we will tell oracle apps
to check daily once every calendar day and see if today is employee's birthday and send email if true.
You need Alert Manager Responsibility to define a new Alert.
Navigate through Alert Manager -> Alert -> Define
Fill the options as given in the screenshot below.
Note that we need to write SQL which satisfies our condition and also to fetch required details. Here is
the SQL
select global_name, date_of_birth, email_address
into &emp_name, &dob, &emp_email
from per_all_people_f
where trunc(sysdate) between effective_start_date and effective_end_date
AND to_char(to_date(date_of_birth),'dd') = to_char(to_date(sysdate),'dd')
AND to_char(to_date(date_of_birth),'mm') = to_char(to_date(sysdate),'mm');
We have to dump these query into "Select Statement" at alert form then you can check the SQL for
syntax using "verify" button.
One point here, if any row that matches condition, it is called exception in Alert.
So when you click "run" button, it will display the number of exceptions occurred (number of rows that
satisfied the condition).
Next step is to define action if condition matches. Don't forget to select action level of type "Detail". This
is because action should be performed once for every Alert Exception.
Then click on "Action Details" button and define the email message.
we also need "Action Sets" and attach the action which we just created.
We can test the alert as follows :
Go to Alert Manager -> Request -> Check, and schedule the Alert to run it sometime after current time.
It will submit a concurrent program.
Once concurrent program is successfully run, the number of exceptions can be verified from Alert
Manager -> History and query for alert.

Which means our Alert is working.Note that you can do many more than just sending mails. Alert can
execute SQL code/function/procedures and it can also run concurrent programs.