Oracle Forms applications often consist of multiple forms that interact with each other. Users may need to exit a form, close it without committing changes, or navigate to another form. For these purposes, Oracle provides built-in procedures such as EXIT_FORM, CLOSE_FORM, and NEW_FORM. Each of these procedures serves a unique role in form navigation and transaction handling. Knowing when and how to use them is crucial for building stable and user-friendly Oracle Forms applications.
In this tutorial, we will explore these three built-ins in detail, understand their differences, and see practical examples of how to use them effectively.
EXIT_FORM in Oracle Forms
The EXIT_FORM built-in is used when you want to terminate the current form session and optionally commit or rollback any pending changes. This is the most common way of exiting a form.
Key Points
- Exits the current form and returns to the calling form or menu.
- Can commit changes if specified.
- Can rollback changes if the user chooses not to save.
Syntax
EXIT_FORM([options]);
Options Available
NO_VALIDATE– Exits immediately without validation.ASK_COMMIT– Prompts the user to save changes if there are uncommitted transactions.DO_COMMIT– Commits the changes automatically before exiting.
Example
BEGIN EXIT_FORM(ASK_COMMIT); END;
In this case, the user will be prompted whether they want to commit changes before leaving the form.
CLOSE_FORM in Oracle Forms
The CLOSE_FORM built-in is used when you want to close a form that was opened using the OPEN_FORM procedure. Unlike EXIT_FORM, this built-in does not necessarily terminate the Oracle Forms session; it simply closes the specified form.
Key Points
- Only works on forms opened with
OPEN_FORM. - Does not exit the entire application; control returns to the calling form.
- You can close a specific form by passing its name.
Syntax
CLOSE_FORM(form_name);
Example
BEGIN
CLOSE_FORM('EMPLOYEE_FORM');
END;
This will close the EMPLOYEE_FORM if it was opened previously with OPEN_FORM.
Difference from EXIT_FORM
EXIT_FORMexits the current form completely (with commit/rollback options).CLOSE_FORMcloses a child form and returns to the parent form without affecting transactions of the parent form.
NEW_FORM in Oracle Forms
The NEW_FORM built-in is used when you want to navigate from one form to another, replacing the current form with a new one. Unlike OPEN_FORM, this does not keep the first form open in memory—it discards it.
Key Points
- Loads a new form and discards the current one from memory.
- Does not return to the calling form.
- Useful when you want to switch forms in a sequence.
Syntax
NEW_FORM(form_name);
Example
BEGIN
NEW_FORM('DEPARTMENT_FORM');
END;
This will close the current form and directly open the DEPARTMENT_FORM.
Important Notes
- Any unsaved changes in the current form may be lost unless committed beforehand.
- Control never returns to the original form once the new form is loaded.
Comparing EXIT_FORM, CLOSE_FORM, and NEW_FORM
To better understand when to use each built-in, let us compare them side by side:
| Built-in | Purpose | Behavior | Use Case |
|---|---|---|---|
| EXIT_FORM | Exit from current form with commit/rollback options | Returns to the menu or calling form | When you want to leave the form session |
| CLOSE_FORM | Close a form opened with OPEN_FORM | Returns to parent form | When you want to close a secondary or child form |
| NEW_FORM | Load a new form and discard the current one | Does not return to old form | When you want to replace the current form with another |
Practical Scenarios
Scenario 1: Exiting with Confirmation
If you want to ensure the user does not lose data, use:
EXIT_FORM(ASK_COMMIT);
This will prompt them to save before exiting.
Scenario 2: Closing a Child Form
Suppose a user opened the EMPLOYEE_FORM from the MAIN_MENU using OPEN_FORM. To close it and return to MAIN_MENU:
CLOSE_FORM('EMPLOYEE_FORM');
Scenario 3: Navigating to a New Form
If the user is in the LOGIN_FORM and you want to switch to the DASHBOARD_FORM after authentication:
NEW_FORM('DASHBOARD_FORM');
Best Practices
- Use EXIT_FORM with ASK_COMMIT – This prevents accidental loss of data.
- Use CLOSE_FORM only for child forms – Avoid using it for main forms.
- Use NEW_FORM for sequential workflows – Best for scenarios like login to main dashboard navigation.
- Validate before navigating – Ensure data integrity by validating inputs before committing or closing.
- Always handle exceptions – Wrap these built-ins in exception blocks to avoid abrupt termination.
Conclusion
Working with EXIT_FORM, CLOSE_FORM, and NEW_FORM in Oracle Forms is essential for controlling user navigation and data management. Each built-in serves a different purpose—EXIT_FORM is for leaving a form with commit/rollback control, CLOSE_FORM is for closing child forms opened via OPEN_FORM, and NEW_FORM is for replacing the current form with a new one. By using them correctly, you can ensure smooth transitions between forms, protect user data, and build more user-friendly Oracle Forms applications.

