ace revealed by magician

Docs hack to save you time!

Posted by

The tech world is a big and varied place, so whilst there are some database customers running on 19c and have applied the latest RUs etc to get them to (at of time of writing) 19.8, there are plenty of customers running on 18c, plenty running on 12.2, plenty on 12.1 and so forth all the way down the version tree.

What this means is that we have a plethora of versions of the documentation available to serve those customers, and since all of those versions are in active use, the various search engines of the world have to decide which versions of the documentation best match the search items you have entered.

Thus if you search for “DBMS_JOB”, then your search engine of choice might show you the 12c version, or the 10.2 version, or the 19c version, all dependent on the multitude of things that search engines use to decide what you should be shown first.

For me, no matter version of the database I am running, I almost always want to see the most up to date version of documentation. Whilst its true that there may be some discrepancies in functionality between versions, I think this is by far outweighed by the fact that documentation (like code) is a “living, breathing” thing. It evolves over time. Feedback from the community, omissions, errors etc all go into making the documentation improve over time in terms of the comprehensibility and completeness of the content. A simple example of this is the presence now of LiveSQL demo hyperlinks throughout the documentation set. For that reason, the current version is where I always want to be (or at least start).

But the search engines don’t know this unless I carefully tailor my search item every time I want to find something in the docs. So I came up with my own solution.  I created a bookmark with the following code:

javascript:(function () { var url = window.location.href; var n = url.indexOf("#"); if ( n > 0 ) { window.location.assign("" + url.substring(n+1) ); } else { n = url.indexOf("database/121"); if ( n > 0 ) { window.location.assign("" + url.substring(n+13,n+18).toUpperCase() ); } else { n = url.indexOf("oracle-database/12.2"); if ( n > 0 ) { window.location.assign("" + url.substring(n+21,n+26).toUpperCase() ); } } }})()

This attempts (and I stress that Smile) to investigate the URL contents of the doc and determine if a redirect to the equivalent section in the latest version of the docs can be done. Due to the way the documentation is built, I only have this working for 12c and above. I don’t have a way yet for going from 11g or 10g to the current docs, but I’m still exploring!

Here’s a sample of it in action. I’m on the 12.1 documentation for DBMS_JOB and with one click, I’m sent over to the 19c version.


Note if you have ad-blockers or javascript interception in your browser the code in this post might not be visible. You might need to turn that off for just long enough to see the code here, and once you’ve created the bookmark you should be good to go as per normal.


Shout out to Tanel Poder for the motivation here.

Got some thoughts? Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.