So you create what appears to be a simple classic SQL report region. It contains a lot of rows so you specify a pretty high number in the “Number of Rows” value under “Report Attributes” “Layout and Pagination”. In this example, I set it to 100.
You run the report and all looks well… until you click “Next >” to get the next page!
All of a sudden, the number of rows dwindles back down to 15 and it stays that way! Imagine trawling through thousands of rows 15 at a time. How annoying!
Luckily for us, the patch fix is simple. All you have to do is:
1. Create a Hidden Item for the page where your report is.
2. Under source -> Source Used, set the Source Used to “Always, replacing any existing value in session state.
3. Under Source -> Source Type, leave the value set to “Static Assignment (value equals source attribute).
4. Under Source -> Source value or expression, set the number you would like for the number of rows. In this instance, I set it to 100.
5. Apply changes then go to your report’s Report Attributes – Layout and Pagination. Under Number of Rows (item), enter you hidden item name.
So you create a List of Values in Oracle Application Express 4.1 using a simple in-line query similar to the one below:
SELECT d, r FROM
(
SELECT 1 d, 1 r
from dual
UNION ALL
select 2 d, 2 r
from dual
UNION ALL
select 3 d, 3 r
from dual
)
You get the following error:
1 error has occurred
LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
You copy the query, paste it in SQL Commands in SQL Workshop, and it ran successfully. You try to create the LOV one more time, but you get the same error again. By this time your brain is working overtime thinking of a thousand different workarounds. There are a hundred strands of hair on your desk resulting from your frustration.
Lucky for you, you stumbled upon this site because the solution is simple.
Put a space after the first “FROM” keyword in your query.
Want to record errors thrown within your Oracle ApEx 4 (and above) application without writing a lot of complicated code? It’s really very easy if you utilize Oracle ApEx’s built in functionalities, which in this situation are Error Handling Function and Team Development. With a small piece of code, we can easily record exceptions thrown in your application and capture all relevant debugging information so we can action on them.
First, we’ll need to write an error handling function. Compile the following code in your database:
create or replace function errorHandling(
p_error in apex_error.t_error )
return apex_error.t_error_result
is
l_result apex_error.t_error_result;
l_reference_id number;
l_constraint_name varchar2(255);
begin
l_result := apex_error.init_error_result (
p_error => p_error );
The code simply grabs all useful information about the error and posts it as a feedback which we can view through the Team Development section of Application Express.
Next, we need to define the error handling function in the application definition:
Login to Application Express
Click on “Application Builder”
Click on the application
Login to Application Express
Click on “Edit Application Properties”
Scroll down to “Error Handling” and add “errorHandling” (without the double quotes) into the field “Error Handling Function”.
Click on the “Apply Changes” button
That’s it! Now we just sit back and watch the bugs trickle down in Team Development.
To view the bugs in Team Development:
Login to Application Express
Click on “Team Development”
Click on “Feedback”
Under “Top Applications”, click on the number on the right hand side (represents total feedbacks/bugs received)
You’ll see the list of the bugs, click on “Edit” on one of them to see the bug details.
You’ll see the error details at the top, and the session values at the time the error was raised down the bottom.
Page zero is a useful page in Oracle ApEx that gets executed for every page request in your application. It can be utilized if theres a certain component or function (eg. computation, validation, region, etc.) in your application that is common to all your pages.
We recently upgraded our Oracle ApEx installation to 4.1. No major issues but a significant annoyance is that when you click on a sortable column on a classic report, the sort image (up and down arrow/pointers) are reversed. It appears that the problem is currently not patched by Oracle, but fortunately, there’s a workaround which works quite nicely and I’ve provided step by step instructions here with screen shots.
There are three main steps to apply the workaround. First step is to add a JavaScript to your page template.
Step 1. Add JavaScript
Login to Application Express
Click on “Application Builder”
Click on the application you want to modify
Click on “Shared Components”
Under “User Interface”, click on “Templates”
In the list of templates, scroll down to “Page” and edit the default template (indicated by a tick)
Paste the following javascript in the Header definition just before the closing head tag (</head>):
<script type="text/javascript">
<!--
function correctStdReportSortImage(pThis){
var $img = pThis instanceof jQuery ? pThis : $(pThis);
//Only run the code if the image actually exists.
//Since this code will be listening to the entire document’s refresh events it could get other events (such as IR)
if ($img.length > 0) {
//If the href has ‘desc’ in it then make sure the image is ascending as the presence of “desc” means column is sorted asc
$img.attr(‘src’, $img.parent().children(‘a’).attr(‘href’).indexOf(‘desc’) > 0 ? $img.attr(‘src’).replace(‘down’, ‘up’) : $img.attr(‘src’).replace(‘up’, ‘down’));
}
}//correctStdReportSortImage
//–>
</script>
Apply changes then click on “Application Builder”
Step 2. Add First Dynamic Action on Page 0
Click on the application you want to modify
Click on page 0 to edit it. If you haven’t created page zero, you need to create one. Instructions on how to create page 0 can be viewed here.
Under “Dynamic Actions” click on the icon to add a new action
Click on “Advanced”
Type in a name (anything will do, for this example I typed in “Page Sort Image Fix Page Load”) then click on the “Next >” button
Under “Event” select “Page Load”, leave condition as is then click on the “Next >” button
Under “Action” select “Execute JavaScript Code” then paste the following JavaScript into “Code”: