Although Discoverer provides many functions for calculation in reports, sometime we require to use custom PL/SQL functions to meet additional Discoverer end user requirements (for example, to provide a complicated calculation). For this we first need to create the functions in database through Toad or other PL/SQL editors.
To access custom PL/SQL functions using Discoverer, you must register the functions in the EUL. When you have registered a custom PL/SQL function, it appears in the list of database functions in the “Edit Calculation dialog” and can be used in the same way as the standard Oracle functions.
Note: To register a PL/SQL function you must have EXECUTE privilege on that function.
You can register custom PL/SQL functions in two ways:
- Import automatically, by importing the functions (recommended)
- Manually
How to register custom PL/SQL functions automatically:
To register PL/SQL functions automatically you must import them in the following way:
1. Choose Tools | Register PL/SQL Functions to display the “PL/SQL Functions dialog: Functions tab”.
2. Click Import to display the “Import PL/SQL Functions dialog”. This dialog enables you to select the PL/SQL functions that you want to import.
3. Select the functions that you want to import. You can select more than one function at a time by holding down the Ctrl key and clicking another function.
4. Click OK.
Discoverer imports the selected functions and displays the function details in the “PL/SQL Functions dialog: Functions tab”. Information about the selected functions is imported automatically. In other words, you do not have to manually enter information or validate the information.
5. Click OK.
The PL/SQL function is now registered for use in Discoverer.
How to register custom PL/SQL functions manually:
To manually register a PL/SQL function for use in Discoverer:
1. Choose Tools | Register PL/SQL Functions to display the “PL/SQL Functions dialog: Functions tab”.
2. Click New and specify the function attributes.
3. Click Validate to check the validity and accuracy of the information you have entered.
4. If the function is invalid, correct the attributes and click Validate again.
5. (Optional) if the function accepts arguments:
a. Display the “PL/SQL Functions dialog: Arguments tab”.
b. On the Arguments tab, click New and specify the argument attributes.
6. Click OK when you have finished defining the function.
The custom PL/SQL function is now registered for use in Discoverer.
It is always recommended to register PL/SQL functions by importing automatically (especially if you have many functions to register), because it is easy to make mistakes when manually entering information about functions. When you import functions, all of the information about each function (for example, names, database links, return types, lists of arguments) is imported.
Create Hello World Page in OAF!
Step 1: Start JDeveloper. Create a New OA Workspace and Empty OA Project with the New…Dialog
Step 2: Create the OA Component Page
Step 3: Modify the Page Layout (Top-level) Region
Step 4: Create the Second Region (Main Content Region)
Step 5: Create the First Item (Empty Field)
Step 6: Create a Container Region for the Go Button
Step 7: Create the Second Item (Go Button)
Step 8: Save Your Work (Save-All)
Step 9: Run Your Page Using the Run Option
Step 10: Add a Controller
Step 11: Edit Your Controller
Share this:
My First Hello World Page in OA Framework!
Share this:
What is Fan Trap in Discoverer and how it handles them?
Account Sales Budget
Account 1 800 1200
Account 2 130 200
Account 3 600 750
Account 4 600 600
The above results are incorrect, because they are based on a single query in which the tables are first joined together in a temporary table, and then the aggregation is performed. However, this approach causes the aggregates to be summed (incorrectly) multiple times.
Discoverer Approach:
If we run the query in Discoverer interrogates the query, detects a fan trap, and rewrites the query to ensure the aggregation is done at the correct level. Discoverer rewrites the query using inline views, one for each master-detail aggregation, and then combines the results of the outer query.
Here are the results from discoverer which is correct:
Account Sales Budget
Account 1 400 400
Account 2 130 100
Account 3 200 750
Account 4 300 200
How to enable fan trap in discoverer?
By default, fan trap detection is always enabled for you. If you want to disable it (however not recommended), you can logon to Discoverer Plus, go to Tools > Options >Advanced Tab and click on ‘Disable fan trap detection’.
How Discoverer handles fan trap?
If a fan trap is detected, Discoverer can usually rewrite the query using inline views to ensure the aggregation is done at the correct level. Discoverer creates an inline view for each master-detail aggregation, and then combines the results of the outer query.
In some circumstances, Discoverer will detect a query that involves an unresolvable fan trap schema, as follows:
In the above circumstances, Discoverer disallows the query and displays an error message.
Share this:
Initial Setup in JDeveloper for OAF Development
Share this:
Registering Custom PLSQL Functions in Discoverer
How to register custom PL/SQL functions automatically:
How to register custom PL/SQL functions manually:
Share this: