Tuesday, March 05, 2024

When #OWNER# is not the OWNER you expected

Oracle provides developers with a ton of dictionary views, many of which containing a column called OWNER, basically most of the DBA* and ALL* views contain such column, with a few exceptions, for instance compare view ALL_INDEXES with ALL_IND_COLUMNS and try to figure out why the latter comes with a column called INDEX_OWNER while the former comes with a simple OWNER.

If you are developing an APEX report based on some of these views and for some reason the report comes with a link to another page where you pass the value of the OWNER column as a parameter using the #OWNER# substitution string, as APEX itself suggests if you click on the helper icon in the link builder, you won't get the OWNER you expect, because #OWNER# is a undocumented APEX substitution string that gets replaced with the name of the primary schema attached to the workspace.

I created a simple application on APEX.ORACLE.COM to show this behavior (open door credentials).

I believe that someone should update the section dedicated to the Substitution strings in the APEX Builder manual and add #OWNER# to the list and I am almost 100% sure that #OWNER# is a legitimate substitution string that gets replaced everywhere, not just accidentally in report links.

So, at the end of the day, if you need to pass the owner of something inside a link, you must rename the column, and I'd recommend avoiding the word OWNER altogether, use SCHEMA instead.


 

No comments:

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles