Oracle Forms applications often require developers to communicate with users during runtime. Whether it’s to confirm an action, provide feedback, or show an error, clear messages improve usability and reduce confusion. One of the simplest yet powerful ways to achieve this is through the MESSAGE built-in. In this tutorial, you will learn what MESSAGE is, how it works, the correct way to use it, and best practices to ensure messages are displayed effectively in your Oracle Forms applications.
What is the MESSAGE Built-in?
The MESSAGE built-in in Oracle Forms is used to display text messages to the end-user during form execution. These messages appear in the message line area of the form, usually located at the bottom of the window.
Unlike alerts, which are dialog boxes requiring user interaction, messages are passive—they do not interrupt the flow of the form. This makes them suitable for informational notifications such as process confirmations, success notices, or status updates.
Syntax of MESSAGE
The basic syntax of MESSAGE is very simple:
MESSAGE (text);
- text: A string (up to 200 characters) that will be displayed to the user.
Example:
MESSAGE('Record saved successfully.');
This will show the message "Record saved successfully." in the message line area.
Important Note: The Need for SYNCHRONIZE
When using MESSAGE, developers often notice that sometimes the message does not appear immediately. This happens because Oracle Forms only processes messages when the runtime engine refreshes the interface.
To force the display of the message right after calling MESSAGE, you must use:
SYNCHRONIZE;
Example with SYNCHRONIZE:
MESSAGE('Data has been saved.');
SYNCHRONIZE;
This ensures that the message is displayed instantly, improving user experience.
When to Use MESSAGE
The MESSAGE built-in is best used for informational and non-critical notifications. Some typical scenarios include:
- Confirming that data has been saved.
- Indicating that a query has been executed.
- Showing the number of records fetched.
- Displaying the current status of a process.
For example:
MESSAGE(:SYSTEM.LAST_QUERY_COUNT || ' records retrieved.'); SYNCHRONIZE;
This shows the number of records returned after a query.
Difference Between MESSAGE and ALERT
It is important to distinguish between MESSAGE and ALERT in Oracle Forms:
- MESSAGE:
- Displays text on the message line.
- Non-blocking (does not interrupt the process).
- Suitable for confirmations, status updates, or hints.
- ALERT:
- Displays a pop-up dialog box.
- Blocking (requires user interaction to continue).
- Suitable for warnings, errors, or critical confirmations.
Examples of Using MESSAGE in Oracle Forms
1. Simple Notification
BEGIN
MESSAGE('Form initialized successfully.');
SYNCHRONIZE;
END;
Displayed when the form is opened, giving users immediate feedback.
2. Record Save Confirmation
BEGIN
COMMIT;
MESSAGE('Record committed to database.');
SYNCHRONIZE;
END;
After saving a record, the message confirms that the action was successful.
3. Displaying System Variables
Oracle Forms provides system variables that can be used with MESSAGE. For example:
MESSAGE('Current user: ' || :SYSTEM.USERNAME);
SYNCHRONIZE;
This shows the Oracle username of the logged-in user.
4. Displaying Record Count
BEGIN
GO_BLOCK('EMPLOYEES');
EXECUTE_QUERY;
MESSAGE(:SYSTEM.LAST_QUERY_COUNT || ' employees found.');
SYNCHRONIZE;
END;
This informs the user how many records were retrieved from the EMPLOYEES block.
Best Practices for Using MESSAGE
To use MESSAGE effectively, keep in mind the following best practices:
- Always use SYNCHRONIZE
Without it, the message may not appear until another screen refresh occurs. - Keep messages short and clear
The message line can display only limited characters. Aim for concise and direct text. - Use for non-critical information
Avoid using MESSAGE for errors or important confirmations where user acknowledgment is required—use ALERT instead. - Avoid excessive use
Too many messages can clutter the user experience and may distract users. - Combine with system variables when useful
For example, display record counts or system states to help users understand the application’s behavior.
Common Mistakes to Avoid
- Forgetting SYNCHRONIZE: The most common mistake, which results in messages not being displayed immediately.
- Overloading MESSAGE with critical information: Use ALERT for important actions like deletions or validation failures.
- Using long messages: Only part of the message may be visible, leading to confusion.
Advanced Usage: Debugging with MESSAGE
During development, MESSAGE can also serve as a quick debugging tool. For example:
MESSAGE('Value of salary: ' || :EMP.SALARY);
SYNCHRONIZE;
This helps you check whether the correct data is being passed during execution. However, for complex debugging, you should use DBMS_OUTPUT or logging tables instead.
Conclusion
The MESSAGE built-in is a simple yet powerful feature in Oracle Forms that allows developers to provide immediate, non-blocking feedback to users. By combining MESSAGE with SYNCHRONIZE, developers can ensure clear communication during form execution. While it should not replace ALERT for critical interactions, MESSAGE is invaluable for everyday confirmations, process feedback, and even basic debugging during development.
By using MESSAGE thoughtfully and following best practices, you can make your Oracle Forms applications more user-friendly, responsive, and informative.

