Defining Functions
Many functions are supplied with Oracle FastFormula. See: Functions. In addition, you can create other functions as you require for use by Oracle FastFormula. Doing this involves two steps: creating a new PL/SQL function, then registering it in the system using the Define Function window.
You need to be aware of two restrictions when creating user defined functions. These are:
- The current release of Oracle Payroll allows you to define functions with IN type parameters only. This means that a user defined function may only return one value. IN OUT and OUT type parameters are not supported.
- User defined functions should not have any commit, rollback, or savepoint statements as these could lead to data integrity problems with the payroll run. In addition, they should not not perform any data manipulation as FastFormula is intended as a read only tool.
Registering the Function
You register a new function by naming and defining it, then creating contexts and parameters for it. Contexts are environment values that do not get passed to the function.
Where a function requires a mixture of contexts (from the FF_CONTEXTS table) and parameters, the contexts should be listed first in the function header followed by the function parameters. Only the function parameters, however, need to be used to call the function from FastFormula.
For example, a function requires eight values: three contexts and five parameters. All eight values are listed in the function header but only the five parameters are used to call the function.
There are three classes of functions you can register:
- external: These are further PL/SQL functions in addition to the ones already delivered with FastFormula. They do not take contexts.
- formula: These functions are formulas called from other formulas. This class of function is not supported in Release 11.
- user defined: In practice, this is the only class of function you need define. User defined functions require both contexts and parameters.
To register a new function for Oracle FastFormula:
1. Enter a unique name for the new function.
2. Select date, number or text as its data type.
3. Select external or user defined as the class of the function.
4. Enter an alias for the function name if you require an alternative name for it. You can also enter a description to explain what the function is for. The Alias and Description fields are both optional.
5. Enter the definition of the function. Use the format: <package name>.<function name>.
To enter context usage and parameter information:
1. Choose the Context Usages button.
2. In the Context Usages window, select as many context items as you require for the function. The data type for each context displays automatically.
Note: The functionality that calls FastFormula, that is, QuickPaint or Payroll Processing, determines what contexts FastFormula has access to from the FF_CONTEXTS table.
3. Save your entries. The sequence number of each context is entered automatically when you do this.
4. Close the Context Usages window and choose the Parameters button.
5. In the Parameters window, select the parameters, or operands, you require to define the function. Type and class display automatically.
6. Check the Optional checkbox if you want the corresponding parameter to be optional.
7. Check the Continuing checkbox if you want the function to make more than one call to the parameter.
Note: You cannot define a parameter as continuing unless you also make it optional. However, an optional parameter does not have to be continuing.
See Also
Oracle FastFormula Overview
Oracle FastFormula Reference