CREATE OR REPLACE FUNCTION CUST_GET_MONTHS_REMAINING (P_DATE DATE ) RETURN NUMBERIS
THIS_YEAR NUMBER;
BEGIN
IF TO_NUMBER(TO_CHAR(P_DATE,'MM')) > 6 AND TO_NUMBER(TO_CHAR(P_DATE,'MM')) <12 THEN
RETURN (12-TO_NUMBER(TO_CHAR(P_DATE,'MM')))+6;
ELSE
RETURN 6-TO_NUMBER(TO_CHAR(P_DATE,'MM'));
END IF;
END;
After the PL-SQL Function is successfully created. Let's register it with the application.
Navigate To: Global HRMS Manager --> Formula Functions
To register a new function for Oracle Fast Formula:
1. Enter a unique name for the new function.
2. Select date, number or text as its data type.
3. Select external 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>.
6. Save your entries.
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.
3. Save your entries. The sequence number of each context is entered automatically
when you do this.
As in our function, we do not have any parameter which could be provided through context usage. So we will not select any value from context usages.
4. Close the Context Usages window and choose the Parameters button.
5. In the Parameters window, enter the parameters, or operands, you require to define
the function. Type and class display automatically.
6. Check the Optional check box if you want the corresponding parameter to be
optional.
7. Check the Continuing check box 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.
8. Save your entries.
No comments:
Post a Comment