When developing Oracle Forms applications, managing data across different program units, forms, or triggers is an essential task. Two commonly used mechanisms for handling such requirements are PARAMETERS and GLOBAL variables. Although both allow you to share and manage data, they are quite different in terms of scope, usage, and behavior.
This article explains the key differences between PARAMETERS and GLOBAL variables in Oracle Forms, how each works, and when to use them with clear examples.
Understanding PARAMETERS in Oracle Forms
PARAMETERS in Oracle Forms are placeholders that allow you to pass values from one form to another or between the form and the database. They are similar to function or procedure parameters in PL/SQL, but they work specifically within Oracle Forms.
Key Characteristics of PARAMETERS:
- Defined in the Form Builder under the Parameters node in the Object Navigator.
- Temporary variables whose values exist only while the form is active.
- Used to pass data when opening a new form using the
CALL_FORM,OPEN_FORM, orNEW_FORMbuilt-ins. - Data type can be CHAR, NUMBER, or DATE.
- Must be explicitly created before you can assign or retrieve values.
- Values are automatically destroyed when the form is closed.
Example of PARAMETERS:
Suppose you want to pass an Employee ID from Form A to Form B.
In Form B (define a parameter):
- Create a parameter named
P_EMPIDof type NUMBER.
In Form A (calling Form B):
DECLARE
pl_id ParamList;
BEGIN
pl_id := Create_Parameter_List('emp_pl');
Add_Parameter(pl_id, 'P_EMPID', TEXT_PARAMETER, :EMP.EMPLOYEE_ID);
CALL_FORM('form_b', NO_HIDE, DO_REPLACE, QUERY_ONLY, pl_id);
END;
Here, the Employee ID is passed to Form B through the parameter.
Understanding GLOBAL Variables in Oracle Forms
GLOBAL variables are memory-based variables that can be created dynamically and used across multiple forms within the same Oracle Forms session.
Key Characteristics of GLOBAL Variables:
- Defined dynamically using the built-in
NAME_INandCOPYprocedures. - Exist as string variables only (VARCHAR2 up to 255 characters).
- Accessible from any form that is open in the same session.
- Do not require explicit declaration in the Form Builder.
- Must be cleared manually using
ERASEafter use. - Remain in memory until erased or until the session ends.
Example of GLOBAL Variables:
Suppose you want to share a Department ID across multiple forms.
In Form A:
COPY(:EMP.DEPT_ID, 'GLOBAL.G_DEPT');
In Form B:
:DEPT_BLOCK.DEPT_ID := NAME_IN('GLOBAL.G_DEPT');
Here, the Department ID is stored in a global variable and later retrieved in another form.
Key Differences Between PARAMETERS and GLOBAL Variables
| Feature | PARAMETERS | GLOBAL Variables |
|---|---|---|
| Definition | Defined in Form Builder before use | Created dynamically at runtime |
| Data Type | CHAR, NUMBER, DATE | Only VARCHAR2 (string) up to 255 chars |
| Scope | Specific to the form they are defined in | Accessible across multiple forms in the same session |
| Persistence | Exist only until the form is closed | Exist until erased or session ends |
| Use Case | Passing values when calling another form | Storing and sharing values across forms at runtime |
| Declaration | Must be predefined in the Object Navigator | No need to declare, created dynamically |
| Clearing | Automatically cleared when the form closes | Must be cleared manually with ERASE |
| Performance | More efficient for passing values | Less efficient if used excessively due to memory use |
When to Use PARAMETERS
- When you want to pass specific values between forms at the time of form call.
- When data types like DATE or NUMBER are needed (since global variables only support strings).
- When you want automatic cleanup after form closure.
- Best for structured and controlled data transfer.
When to Use GLOBAL Variables
- When values need to be shared across multiple forms during the session.
- For temporary storage of small text values like user IDs, status flags, or configuration options.
- When you want to avoid pre-defining variables in the Form Builder.
- Suitable for dynamic and flexible runtime data sharing.
Best Practices
- Use PARAMETERS for formal data passing
They are safer, type-specific, and automatically cleaned up when the form closes. - Use GLOBAL variables sparingly
Since they remain in memory, overuse may cause performance issues or make debugging harder. - Clear GLOBAL variables after use
AlwaysERASE('GLOBAL.variable_name')once you no longer need them. - Combine both approaches
In complex applications, you may use PARAMETERS for structured communication and GLOBALs for lightweight session-level flags.
Conclusion
Both PARAMETERS and GLOBAL variables in Oracle Forms serve the purpose of sharing data, but they work differently. PARAMETERS are best for structured, type-specific, and temporary communication between forms, while GLOBAL variables provide a flexible way to share string values across multiple forms during a session. Understanding when to use each ensures cleaner, more maintainable, and efficient Oracle Forms applications.

