Substitution Variables over a Database Link in APEX

Situation: APEX 3.1.2 on a 9.2.0.6.0 database linking to Siebel.

When I was building a report on 2 tables, one local and one remote, I noticed a very big performance issue. I thought I had solved this by adding a DRIVING_SITE hint, but this wasn’t enough.

The query looked something like this:

select /*+ DRIVING_SITE(e) */
e.ename
, d.dname
from emp e
, dept@remote d
where d.id = e.dept_id
and d.loc = :P2_DEPT_LOC

In the page, a user can select a Department Location and press a button. The report data is then generated based on this selected location.

To debug this, I started investigating trace files on the remote database. What I immediately noticed was, that the Substitution Variable :P2_DEPT_LOC wasn’t replaced by it’s value that was selected in the APEX page. So that was the problem.

To solve this, I simply had to replace the way the Substitution Variable was called. The query was changed to:


select /*+ DRIVING_SITE(e) */
e.ename
, d.dname
from emp e
, dept@remote d
where d.id = e.dept_id
and d.loc = '&P2_DEPT_LOC.'

And everything was okay. The time it took to load the page changed from 45 minutes to 0.05 seconds.

But be aware! This kind of solutions opens the door for SQL Injection, so make sure that you handle the input before parsing the query.

Win my book!

On his blog, the German APEX developer Carsten Cerny has put up a competition to win my book.
Click here to visit Carsten’s site and enter the competition.

It’s a great promotion for the Oracle APEX 4.0 Cookbook.

So thanks to Carsten and be sure to visit his site for more information on this competition and APEX Development in general.

Update: the competition has finished and the winners Phil and Stephane will be receiving the book shortly. Congratulations to them!

Oracle APEX 4.0 Cookbook

It has now been over a month since the Oracle APEX 4.0 Cookbook has been published.
The first sales information and reviews are in and it is looking great.

It has been a real fun few weeks with a lot of congratulations and positive feedback.
On January 12th I had a meeting at Oracle Netherlands headquarters in De Meern to present the first signed copy of the book to Iloon Ellen-Wolff, the Global Technical Lead for Application Express for the Oracle Corporation.

Handing over the first signed copy

Also the first reviews for the book by fellow APEX developers started rolling in. Like these from Rinie Romme and Christian Rokitta. But also a great reference from Joel Kallman, the Director of Software Development at Oracle.

All in all things are still looking great for the book and I’m curious where it will lead me in the future. At least I’ve been noticed by the community now :)

Oracle APEX 4.0 Cookbook out December 15th

It’s now official. On December 15th the Oracle APEX 4.0 Cookbook that I have written together with Marcel van der Plas will be available from (e-)bookstores everywhere.

It can still be ordered from the Packt Publishing website, but also at many other bookstores. Use Google to search for ISBN 978-1-84968-134-6 to find if it’s available in your favorite store like Amazon.com.

Excuse me while I do a little dance of joy :)
Perfect Strangers – Dance of joy

Pre-order Oracle APEX 4.0 Cookbook now!

For the past months I have been working together with Marcel van der Plas on a book on APEX 4.0. The publisher Packt has just released the website, so it can now be pre-ordered.

Find the link here: Oracle APEX 4.0 Cookbook

The book offers more than 70 recipes that cover almost all topics of Application Express 4.0.
We are currently finishing up and expect that the book will come out in January.

Review: Oracle Application Express 3.2 – The Essentials and More

For the past few months I’ve been working together with Marcel van der Plas on a new book that will cover APEX 4.0. But the Application Express 3.2 community is still very much alive.
In May of this year the authors Arie Geller and Matthew Lyon have published a book at Packt Publishing describing some (or most) of the essential features of APEX 3.2. Since I am writing for the same publisher, I have been asked to review the book and give my opinion.

After reading the book description on the internet and on the cover, I was expecting a book that would introduce the reader softly into the world of developing web applications with APEX. So I did what I usually do with a new tech book; I opened it at a random page and start browsing it for a while.

To my big surprise, it scared the living daylights out of me!

Instead of reading the usual descriptions of APEX features that I’ve learned to know in the past few years, I found pages and pages full of stuff I didn’t know! Was there so much that I could still learn? After so many projects, posting blogs, writing my book, could it be that APEX holds many more secrets?

The answer to that would be simply yes. This book taught me new ways of working with APEX. But how did they do that?

From the beginning of the book, the authors are comfortable in mixing the basics with many advanced features. They are not afraid to describe a simple task as creating a new item with an example of javascript calls.
But this is also a bit of a problem with a part of the book. Because the authors have tried to tell -everything- there is to know about APEX, they had to make compromises in how to describe the different aspects. This often results in quickly stepping over the more simple descriptions and start on the advanced bits. Because of this the book looks not as suitable for beginning developers as I would expect.
But don’t let this scare away the developers just starting with Application Express, the book is in fact suited for beginners and advanced users alike. If you can read past the bits that aren’t up your alley, there are many gems to be found for any developer.

Arie and Matthew have described a huge number of subjects in the book. They not only covered the programming side of APEX, but also the server architecture and configuration of the APEX environment.
The subject that immediately drew my attention is Globalization and Localization. Since I’ve had experience in that field, I read this chapter with extra interest. As a bonus Arie explained a great deal about creating right-to-left applications in the next chapter. This is his area of expertise and you can tell by the chapter. A very thorough description, with smart solutions for every developer that needs to make his or her application available for right-to-left reading users.

It’s impossible to describe all chapters of the book, simply because there is so much in the book. The 24 chapters will lead you through all parts of Application Express 3.2 and guide you in building applications and configuring the building environment. I recommend this book as a good read for anyone that is working with or is thinking of working with Application Express.

If this review made you curious about “Oracle Application Express 3.2 – The Essentials and More”. You can buy the book directly at the website of Packt as a hard-copy or eBook.

Passed APEX 3.2 Beta Certification

Oracle Application Express Developer Certified Expert Logo

Yesterday I returned from my summer vacation in the French town of Pierrefite-sur-Sauldre. Me and my family spend 2 wonderful weeks in the Alicourts resort.

This morning I opened my e-mail for the first time and found a nice little surprise from the Oracle Certification Program.
A while ago (in february) I participated in the Application Express 3.2 certification beta program. I took the exam in Utrecht and waited for the beta period to end.
The e-mail I received from Oracle and Pearson VUE contained a link to my Score Report. The verdict was: Passed!

So now I’m officially certified in “1Z1-450: Oracle Application Express 3.2: Developing Web Applications” or Oracle Application Express Developer Certified Expert for “short” :)

“Oracle Application Express 3.2 – The Essentials and More” book published

Last week a new APEX book was published. It was written by Arie Geller and Matthew Lyon. It’s on the current version of APEX and covers basic and advanced features of Application Express 3.2.

I will post a review somewhere in the coming weeks, but since the publisher is the same that will be bringing out my own APEX 4.0 book later this year, I wanted to let you know that this is out there. You can find more information at the website of
Packt Publishing

TNS_ADMIN for multiple Oracle Homes

Last week I tried to install Oracle Forms 11g. This install created a new Oracle_Home on my computer, which resulted in my database not starting up anymore.
The cause of this was, that my computer did not pick up the right tnsnames.ora file anymore, but instead it picked up the new tnsnames.ora that was created during my Forms installation.

To avoid having to have multiple copies of the same tnsnames.ora file on your computer, you can create a registry key in all Oracle_Homes. This will force your computer to pick up the same file for all your Oracle_Homes and thus allow you to have just a single copy of tnsnames.ora to manage.

To do this, start the Windows Registry editor by using Start -> Run -> Regedit and find your Oracle_Homes under HKEY_LOCAL_MACHINE -> SOFTWARE -> ORACLE and rightclick on your Oracle_Home entry. Choose New -> String Value and enter the required information similar to the following screenshot (directory on harddrive may differ on your computer).

TNS_ADMIN registry entry

The registry key is called TNS_ADMIN and it’s value is the location of your tnsnames.ora file on the harddrive.
But remember to only add this key to the Oracle_Homes that do not contain your central tnsnames.ora.

APEX 4.0 New Features

I did another Whitebook (in dutch). This time the subject is New Features in the APEX 4.0 Early Adopters release.
You can find it at the Whitehorses website.

By the way; besides this personal blog I also publish articles on the blog at the Whitehorses site together with the other Oracle, Java and SOA specialists of the company. These blogs are in english. A direct link to the list of my blogs is in my profile.