A script-enabled browser is required for this page to function properly.

Displaying an Alert

To display an alert, your application must execute the SHOW_ALERT Built-in subprogram from a trigger or user-named subprogram. SHOW_ALERT is a function that returns a numeric constant.

Show_Alert(alert_name) Return NUMBER;

The constant returned by the SHOW_ALERT function indicates which alert button the operator selected and is one of the following: ALERT_BUTTON1, ALERT_BUTTON2, ALERT_BUTTON3.

You can assign the return value of the SHOW_ALERT function to a variable, and then take different actions in your trigger depending on the value of that variable; that is, depending on which button the operator selected.

Displaying an alert

Examples

For example, you might create an alert that displays the following message:

"Product price must be entered. Show price List now?"

Button 1 is labeled OK and button 2 is labeled Cancel. This alert is invoked from a When-Button-Pressed trigger attached to a button that calculates line-item totals for orders.

If the current price is entered for the item, the calculation executes successfully; if the price is missing, the alert displays. The operator selects Button 1 (OK) to invoke a window that displays current product prices, or Button 2 (Cancel) to cancel the operation.

When-Button-Pressed Trigger:

-- Declare a NUMBER variable for the
-- constant returned by the Show_Alert function
DECLARE
alert_button NUMBER;
BEGIN
IF :item.price IS NOT NULL THEN
-- call the user-named calculation subprogram
calculate_totals;
ELSE -- display the alert
alert_button := Show_Alert('no_price_alert');
IF alert_button = ALERT_BUTTON1 THEN
-- invoke the price List window
Go_Block('product_prices');
END IF; -- do nothing if operator selects button 2
END IF;
END;

SHOW_ALERT Built-in