ApEx Error Handling Function Oracle Team Development

Oracle Application Express Error Handling Function

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
l_result apex_error.t_error_result;
l_reference_id number;
l_constraint_name varchar2(255);
l_result := apex_error.init_error_result (
p_error => p_error );

— Log ORA errors only
if l_result.additional_info like ‘ORA-%’ then
apex_util.submit_feedback (
p_comment => ‘[message]= ‘ || p_error.message || chr(10) ||
‘[additional_info]=’ || p_error.additional_info || chr(10) ||
‘[display_location]=’ || p_error.display_location || chr(10) ||
‘[association_type]=’ || p_error.association_type || chr(10) ||
‘[page_item_name]=’ || p_error.page_item_name || chr(10) ||
‘[region_id]=’ || p_error.region_id || chr(10) ||
‘[column_alias]=’ || p_error.column_alias || chr(10) ||
‘[row_num]=’ || p_error.row_num || chr(10) ||
‘[error_backtrace]=’ || p_error.error_backtrace || chr(10) ||
‘[component_type]=’ || p_error.component.type || chr(10) ||
‘[component_id]=’ || || chr(10) ||
‘[component_name]=’ ||,
p_type => 3,
p_application_id => v(‘APP_ID’),
p_page_id => v(‘APP_PAGE_ID’),
p_email => null);
end if;

return l_result;
end errorHandling;

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
Error Handling Function
Error Handling Function

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.
Error Details
Error Details from Feedback in Team Development
Session Values
Session Values from Feedback in Team Development

How to Track SEO Campaign Effectively

Tracking a SEO campaign can be a very challenging task. One way to monitor your progress is to determine your website’s position on Google for a given search term. There are hundreds of free services that allow you to determine this but most aren’t very reliable. There is a paid service that allows you not only to determine your Google  position rank effectively, but also save all your queries against your profile, giving you the intelligence to determine the effectiveness of your campaign.

The Google Position Checker gives you a real time indication of where your website is placed in the Google search engine results pages. Every single query is also saved against your profile so you can effectively track your campaign for a given keyword. If you’re new to the website, you will be given 25 free Save Credits just for signing up so you can trial the service. If you run out of credits, it only costs US$5 for 500 Save Credits. Every Save Credit entitles you to one successful query and the result is saved against your profile.

Track Progress of Each Website

Track website progress

Capture Each Individual Query and Result

View individual query

Monitor Search Term Position Trend in Google via Chart

Trend chart

Automate Your Campaign Tracking

Automate campaign tracking

You can automatically track your campaign by specifying the number of days you want to re-run the query for.

What are you waiting for? Sign up to start your trial today.

Games XBOX 360

NBA 2K12 Fail

This amused me the other day. I was playing NBA 2K12 on XBOX 360 and this popped up in the NBA.COM news spash section. For those of you who aren’t basketball enthusiasts, the player on the left is Lebron James. He is being guarded by the guy on the right who is Mario Chalmers. The only problem is, they play for the same team, the Miami Heat!

Virtual reality will rule this world one day. Scary isn’t it?

Mulcher Product Review

Ozito Silent Shredder Review

If you’re like me and got a few trees and shrubs that you need to maintain regularly around your property, then you need one of these babies. It’s a powerful mulcher that will munch branches around 30cm in diameter into little pieces.

You can pretty much trim or cut down your plants and trees around the yard and shred the limbs with one of these and then throw the mulch back in your yard. I love it. It made my life a whole lot easier.

I used to have piles of tree limbs all over the place after tending to our yard. I would spend countless hours cutting the branches into small pieces so they fit inside our green waste bin. It would take weeks before the mess is cleaned up. These days it takes me one day to trim our trees and get rid of the waste!

Check out my video review below.


  • 2400W induction motor provides powerful shredding action, quiet operation and greater durability
  • 40mm cutting capacity for shredding twigs, sticks and branches
  • 10:1 mulching ratio breaks waste into small pieces which helps accelerate the composting process and provides nutritional value to plants and gardens
  • Self feeding roller cutting system automatically pulls waste material through the roller cutting blade for ease of use
  • No-volt safety release switch prevents the shredder from turning on automatically after a power interruption
  • Transport handle and large wheels allow easy transport around the garden
  • 2 Year Replacement Warranty

Benefits / Specification

  • Power: 2400W
  • No load speed: 40 RPM
  • Max. cutting diameter: 40mm
  • Mulching ratio: 10:1
  • Blades: Roller cutting system
  • Direction: Forward & reverse
  • Collection bag: 50 litres
  • Weight: 25kg
ApEx Oracle

How to Create Page Zero in Oracle Application Express 4.1

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.

To create page 0, do the following:

  • Login to Application Express
Login to Oracle Application Express
Login to Oracle Application Express
  • Click on “Application Builder”
  • Click on the application you want to modify
  • Click the “Create Page >” button
Create Page
Create Page
  • Select “Page Zero” as the page type
Create Page Zero
Create Page Zero
  • Click Finish
ApEx Bug Oracle

Oracle ApEx 4.1 Incorrect Sort Order Image for Classic Reports

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
Login to Oracle Application Express
Login to Oracle 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)
Edit Default Page Theme
Edit Default Page Theme
  • 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’));

Paste Code in Header
Paste Code in Header
  • 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.
Click Page 0
Click on Page 0
  • Under “Dynamic Actions” click on the icon to add a new action
Add New Dynamic Action
Add New Dynamic Action
  • Click on “Advanced”
Click On Advanced
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
Type in Dynamic Action Name
Type in Dynamic Action Name
  • Under “Event” select “Page Load”, leave condition as is then click on the “Next >” button
Select Page Load Event
Select Page Load Event
  • Under “Action” select “Execute JavaScript Code” then paste the following JavaScript into “Code”:


Select Execute JS Code
Select Execute JS Code
  • Click Next
  • Under “Selection Type” select “jQuery Selector” then paste the following text under “jQuery Selector”:

.rpt-sort img

jQuery Selector
jQuery Selector
  • Click on the “Create” button

Step 3. Add Second Dynamic Action on Page 0

  • 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 After Refresh”) then click on the “Next >” button
Type in 2nd Dynamic Action Name
Type in 2nd Dynamic Action Name
  • Under “Event” select “After Refresh”
  • Under “Selection Type” select “DOM Object”
  • Under “DOM Object” enter the following text:


After Refresh Action Parameters
After Refresh Action Parameters
  • Leave condition as is then click on the “Next >” button
  • Under “Action” select “Execute JavaScript Code” then paste the following JavaScript into “Code”:

correctStdReportSortImage($('.rpt-sort img'));

2nd Dynamic Action JS
2nd Dynamic Action JS
  • Click Next
  • Leave “Selection Type” as is then click on the “Create” button

That’s it. Good luck.