Skip navigation.


Alert Function

Denes Kubicek - Wed, 2015-02-18 10:51
In APEX you will probably use javascript alert function in many cases by saying:

alert ('some message');

The popup box you get looks a bit strange and outdated. As an alternative to this you may use this function call:

function get_alert (p_message,p_id) {$("<div/>", { "html":p_message}).attr({"title":"Error has occurred!"}).dialog({
buttons:{"Go to Error":function(){$(this).dialog("close");
}); }

As you can see in this example, you can add additional functions to this alert box in order to do something after closing of the alert message. You can choose to display the alert as a modal window as well.

Categories: Development


Denes Kubicek - Tue, 2015-02-17 11:44
Alle, die eine Beschäftigung mit Oracle APEX suchen, sollten hier reinschauen:

Joel's Blog

Auch einige Stellenangebote aus Deutschland und Schweiz.

Categories: Development

EM 12C RACI and Maintenance Task

Arun Bavera - Fri, 2015-02-13 10:10
TASK RESPONSIBLE ACCOUNTABLE CONSULTED INFORMED Define Monitoring Requirements Target Owners, Infrastructure Teams, EM Admin EM Admin Installation planning and architecture EM Admin EM Admin Target Owners, Infrastructure Installation and configuration of EM EM Admin EM Admin Defining Agent deployment and patching procedures and processes EM Admin EM Admin Security and User Administration EM Admin/Security Admin EM Admin Admin Group Creation EM Admin EM Admin Target Owners Agent Deployment (can be performed by target owners) Target Owners Target Owners EM Admin Agent Patching (can be performed by target owners) Target Owners Target Owners EM Admin Target Configuration and Availability Target Owners Target Owners Agent Troubleshooting Target Owners, EM Admin EM Admin Target Troubleshooting Target Owners Target Owners EM Admin Weekly/Monthly/Quarterly Maintenance EM Admin EM Admin Target Owners OMS Patching EM Admin EM Admin Target OwnersRECOMMENDED MAINTENANCE TASKS TASK DAILY BIWEEKLY MONTHLY QUARTERLY Review critical EM component availability X Review events, incidents and problems for EM related infrastructure X Review overall health of the system including the job system, backlog, load, notifications and task performance X Review Agent issues for obvious problems (i.e. large percentage of agents with an unreachable status) X Review Agent issues (deeper /more detailed review of agents with consistent or continual problems) X Review metric trending for anything out of bounds X Evaluate database (performance, sizing, fragmentation) X Check for updates in Self Update (plug-ins, connectors, agents, etc.) Note that there is an out-of-box ruleset that will provide notification for the availability of new updates X Check for recommended patches XReferences:
Categories: Development

Easy quiz: rownum < NaN

XTended Oracle SQL - Tue, 2015-02-10 15:25

As you know, NaN is a “Not a Number”.
How do you think, what would be the result of the following query? (0f/0 == NaN)

select count(*) cnt from dual where rownum < 0f/0;

SQL> select count(*) cnt, 0f/0 from dual where rownum < 0f/0;

       CNT       0F/0
---------- ----------
         1        Nan

1 row selected.

Ok, when you know the result, try to guess what will return this query:

select count(*) cnt from dual where 1f/0 < 0f/0;
SQL> select count(*) cnt from dual where 1f/0 < 0f/0;


1 row selected.

[collapse] PS

1 * X < 0 * Y

So we know now which non-negative values we should to substitute for X and Y in this expression, to make it true.

Categories: Development

select * from table where rownum=1

XTended Oracle SQL - Sun, 2015-02-08 17:40

I never thought I would have to optimize so simple query as

select col1, col2, col4, col7 from table where rownum=1

(even though I read recently “SELECT * FROM TABLE” Runs Out Of TEMP Space)
But a few days ago frequent executions of this query caused big problems on the one of our databases( because of adaptive serial direct path reads.

I don’t know why, but I felt intuitively that full table scan with “First K rows” optimization (“_optimizer_rownum_pred_based_fkr“=true) should turn off adaptive serial direct path reads. It seems quite logical to me.

PS. Unfortunately I had a little time, so I didn’t investigate what process and why it was doing that, I just created profile with “index full scan” access, and it completely solved the problem.

Categories: Development

Changing Target ownership after the discovery of Targets in EM12c

Arun Bavera - Thu, 2015-02-05 16:29
Building emcli commands to Change ownership of  Targets

select 'emcli change_target_owner -target="'||target_name||':host" -owner="EM_ADMIN" -new_owner="WEB_ADMIN"' from mgmt$target where target_type='host' and target_name like 'mypattern%'


Categories: Development

APEX 5.0 Fixed Headings for Interactive Reports

Dimitri Gielis - Wed, 2015-02-04 17:30
When you click on the Attributes of your Interactive Report there's a neath little new features included called "Heading - Fixed to" with as options: None, Region and Page

We've got this request from many customers and it has always been a pain to get it working in every condition with APEX 4.x, but no hacking anymore - it's there now in APEX 5.0.
When you start to scroll the column header will move up and the content will scroll underneath it.

Here's a quick demo:

Categories: Development

APEX 5.0 EA3 - Universal Theme Styles - Gray!

Dimitri Gielis - Wed, 2015-02-04 16:17
In APEX 5.0 theme 42 is included - this is the Universal Theme. The theme comes with two styles: Blue and Gray.

The UI is so much improved in APEX 5, it's really a game changer. When you look at the details for example from such a style you will see it's using a Less file (Less is a CSS pre-processor) behind the scenes. So it's very easy to make changes to the CSS. But you probably even don't need to do that as the development team allows you to make customisations with ThemeRoller which generates JSON (another nice example where JSON is used - interested in JSON - I did some other posts on this blog about JSON).

To change the color for example, below you see the JSON for that.

Note that Theme Roller will generate the JSON for you. Accept from those customisations, the blue and gray style are using the exact same css.

From the Blue style many screenshots have been posted already, but I love the Gray style too, here's a screenshot when you switch the sample application's style to Gray.

Categories: Development

Developing On-Device Java Mobile Apps for iOS...and Android Too

Shay Shmeltzer - Wed, 2015-02-04 15:25

At the last JavaOne conference I presented a session titled "Developing On-Device Java Mobile Apps for iOS...and Android Too"

The recording of this session just became available, and I wanted to share it with you.

This session should be a good introduction to how Oracle enables Java developers to take their skills to the mobile world.

The first 28 minutes provide the overview, but if you are not into slides fast forward to minute 29 and start watching the extensive demo of developing an iOS application with Java and Eclipse. 

&amp;amp;lt;br /&amp;amp;gt;

Categories: Development

Moving Oracle Inventory from one location to Another

Arun Bavera - Wed, 2015-02-04 13:03
Moving Oracle Inventory from one location to Another:

cp -pR /home/emuser/oraInventory/*  /opt/app/oracle/oraInventory

sed -i 's|'/home/emuser/oraInventory'|'/opt/app/oracle/oraInventory'|g' oraInst.loc
sed -i 's|'/home/emuser/oraInventory'|'/opt/app/oracle/oraInventory'|g'

grep -rl 'oraInventory' ./ | xargs sed -i 's|'/home/emuser/oraInventory'|'/opt/app/oracle/oraInventory'|g'

vi /etc/oraInst.loc

[root@myhostname oraInventory]# ./
Changing permissions of /opt/app/oracle/oraInventory
Adding read,write permissions for group,Removing read,write,execute permissions for world.
Changing groupname of /opt/app/oracle/oraInventory to oinstall.
The execution of the script is complete
Categories: Development

INDEX FULL SCAN (MIN/MAX) with two identical MIN()

XTended Oracle SQL - Wed, 2015-02-04 09:39

I’ve just noticed an interesting thing:

Assume, that we have a simple query with “MIN(ID)” that works through “Index full scan(MIN/MAX)”:

SQL> explain plan for
  2  select
  3     min(ID)      as x
  4  from tab1
  5  where ID is not null;


SQL> select * from table(dbms_xplan.display);

Plan hash value: 4170136576

| Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT            |         |     1 |     4 |     3   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE             |         |     1 |     4 |            |          |
|   2 |   FIRST ROW                 |         |     1 |     4 |     3   (0)| 00:00:01 |
|*  3 |    INDEX FULL SCAN (MIN/MAX)| IX_TAB1 |     1 |     4 |     3   (0)| 00:00:01 |

Predicate Information (identified by operation id):

   3 - filter("ID" IS NOT NULL)

Test tables
create table tab1(id, x, padding)
   with gen as (select level n from dual connect by level<=1000)
   select g1.n, g2.n, rpad(rownum,10,'x')
   from gen g1,gen g2;
create index ix_tab1 on tab1(id, x);
exec dbms_stats.gather_table_stats('','TAB1');

But look what will happen if we add one more “MIN(ID)”:

SQL> explain plan for
  2  select
  3     min(ID)      as x
  4   , min(ID)+1000 as x1000
  5  from tab1
  6  where ID is not null;


SQL> select * from table(dbms_xplan.display);

Plan hash value: 3397888171

| Id  | Operation             | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT      |         |     1 |     4 |  3075  (17)| 00:00:02 |
|   1 |  SORT AGGREGATE       |         |     1 |     4 |            |          |
|*  2 |   INDEX FAST FULL SCAN| IX_TAB1 |   999K|  3906K|  3075  (17)| 00:00:02 |

Predicate Information (identified by operation id):

   2 - filter("ID" IS NOT NULL)

At first I thought it was the old limitation from “MIN/MAX index access is not used if query has multiple MIN/MAX functions (Doc ID 316467.1)”, but we can get same plan by using hint:

SQL> explain plan for
  2  select/*+ index(tab1) */
  3     min(ID)      as x
  4   , min(ID)+1000 as x1000
  5  from tab1
  6  where ID is not null;


SQL> select * from table(dbms_xplan.display);

Plan hash value: 4170136576

| Id  | Operation                   | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT            |         |     1 |     4 |  3433  (22)| 00:00:02 |
|   1 |  SORT AGGREGATE             |         |     1 |     4 |            |          |
|   2 |   FIRST ROW                 |         |   999K|  3906K|  3433  (22)| 00:00:02 |
|*  3 |    INDEX FULL SCAN (MIN/MAX)| IX_TAB1 |   999K|  3906K|  3433  (22)| 00:00:02 |

Predicate Information (identified by operation id):

   3 - filter("ID" IS NOT NULL)

So, we can see that the real problem lies in the wrong cardinality calculation.

Of course, we can avoid this problem using the old method – with simple inner view:

SQL> explain plan for
  2  select x, x+1000
  3  from (
  4        select
  5           min(ID)      as x
  6        from tab1
  7        where ID is not null
  8       );


SQL> select * from table(dbms_xplan.display);

Plan hash value: 2347179087

| Id  | Operation                    | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT             |         |     1 |    13 |     3   (0)| 00:00:01 |
|   1 |  VIEW                        |         |     1 |    13 |     3   (0)| 00:00:01 |
|   2 |   SORT AGGREGATE             |         |     1 |     4 |            |          |
|   3 |    FIRST ROW                 |         |     1 |     4 |     3   (0)| 00:00:01 |
|*  4 |     INDEX FULL SCAN (MIN/MAX)| IX_TAB1 |     1 |     4 |     3   (0)| 00:00:01 |

Predicate Information (identified by operation id):

   4 - filter("ID" IS NOT NULL)
Categories: Development

APEX 5.0 - Run Applications in New Tabs

Denes Kubicek - Wed, 2015-02-04 02:31
If you are using Firefox you will probably have an issue with running pages from APEX Builder 5.0 in new Tabs. Now, the links are working differently and normally clicking at button "Save and Run Page" will open a new window. In order to get it opened in a new tab, you will need a plugin Tab Mix Plus. Once you have it, you will need to change the settings there as shown in the screenshots below.

Categories: Development

Test Drive Oracle APEX 5.0 Early Adopter 3!

Patrick Wolf - Sun, 2015-02-01 05:49
It’s here! Oracle Application Express 5.0 Early Adopter 3 is available at and we are really looking forward to get your feedback (via the Feedback link in the Builder)! A list of all new features of EA3 and a … Continue reading →
Categories: Development

APEX 5.0 EA3 released with Universal Theme

Dimitri Gielis - Sat, 2015-01-31 16:30
Today Oracle released the latest Early Adopter release of APEX 5.0.

The release is packed with new features, but one of the biggest improvements you can find in the UI.

For me the Universal Theme with Theme Roller, Theme Styles and Template Options is the absolute killer feature of APEX 5.0. I can't better describe Universal Theme as how Oracle is describing it:

Universal Theme is an all-new user interface for your applications that has been built from the ground up for Application Express 5. It is a simpler, yet more capable theme that does away with excessive templates and enable effortless customization with Theme Roller, Template Options, and Theme Styles. Universal Theme is the culmination of all of our UI enhancements and aims to empower developers to build modern, responsive, sophisticated applications without requiring expert knowledge of HTML, CSS, or JavaScript.

The issue with APEX 4.x was the build-in themes became out-dated today, so many of us looked at integrating Bootstrap, Foundation or other frameworks. But APEX 5.0 has send us at WARP-speed to a new UI, suddenly out-of-the-box your applications are modern, responsive, flat, ... everything you can expect from a UI today. Many new components are now part of the UI: like the new Carousel and Cards region are some of my favourites.

If you are interested to know everything about the new UI, Roel and I teamed up with a one-day APEX 5.0 UI Training day.

Happy playing with APEX 5.0 EA3 and don't forget to give feedback to the development team, this is the last time you can before APEX 5.0 hits production.
Categories: Development

Getting started with iOS development using Eclipse and Java

Shay Shmeltzer - Fri, 2015-01-30 16:05

Want to use Eclipse to build an on-device mobile application that runs on iOS devices (iPhones and iPads)?

No problem - here is a step by step demo on how to do this:

Oh, and by the way the same app will function also on Android without any changes to the code :-)  

This is an extract from an online seminar that I recorded for one of Oracle's Virtual Technology Summits - and I figured people who didn't sign up for that event might still benefit from having access to the demo part of the video.

In the demo I show how to build an on-device app that access local data as well as remote data through web services, and how easy it is to integrate device features too.

If you want to try this on your own, get a copy of the Oracle Enterprise Pack for Eclipse, and follow the setup steps in the tutorial here.

And then just follow the video steps.

The location of the web service I accessed is at:

And the Java classes I use to simulate local data are  here.

Categories: Development

Preparing architecture for APEX 5.0 upgrade

Dimitri Gielis - Thu, 2015-01-29 18:10
I doubted to set the title of this post to "Running APEX 4.2 and 5.0 in the same Oracle instance", but decided not to do that, but that is basically what I will do. Before going into details, I'll share my architecture.

In December 2013 I wrote it was time to update your APEX environment and I gave a quick overview of the architecture we're using. I thought it's time to review that post, so below you find how my preferred APEX architecture is today and tomorrow (once APEX 5 is production).

I'm using Apache as a reverse proxy in front of Tomcat. I'm not going in too much detail about which version to take: Apache v2.2 vs 2.4 and Tomcat v7 vs 8. There're many threads on the internet about that and I guess it depends your environment and your personal feeling. I've been using both versions but currently I'm on Apache v2.2 because it comes as a default with RHEL / OEL6 and SELinux is configured out of the box to protect the webserver. And for Tomcat I'm using v8 as that's the basis for the future versions of Tomcat (v9) and when you want to do Websockets for example, v8 has a more improved spec.

A few years ago we had the discussion about mod_plsql vs APEX Listener (now Oracle REST Data Services - ORDS). I think today, it's clear ORDS is the way to go as it gives you much more features and is proven technology.

For APEX I'm always on the latest version as fast as I can, as with every new release there're great improvements and fixes.

And finally the Oracle Database I'm on 12cR1 because I like the pluggable database concept and the other features it brings. I guess most people will go to 12c very soon, as 11.2 premier support ends this month. You can read more about when what is still supported in this doc.

But in this post I want to show you how easy it is to prepare your environment for APEX 5 and to test the upgrade with an architecture as above. I basically want to run APEX 4.2 and 5.0 next to each other. I'll clone my PDB and apply the APEX 5 installation on the new PDB. Next I'll configure ORDS so it knows to which database it needs to point to depending the url I'll call.

Step 1. Clone the PDB 

sqlplus / as sysdba

create pluggable database APEX50_PDB from APEX42_PDB file_name_convert=('/u01/app/oracle/oradata/cdb/APEX42_PDB','/u01/app/oracle/oradata/cdb/APEX50_PDB');

Step 2. Open the PDB and install APEX 5.0

alter pluggable database apex50_pdb open;

So now we have a new database which is a copy of our existing database open and ready to be used. Next we will need to install APEX 5.0. As the time of writing APEX 5.0 is not available yet, but it will probably be - connect to the new PDB and run @apexins... (follow the installation guide of APEX 5.0 once available!)

Step 3. Configure ORDS

With SQL Developer you can configure ORDS and add the connection to the new PDB.
In SQL Developer 4.1, first setup a connection to your ORDS (Tools > Manage REST Data Services Connections > Add Connection). Next open the ORDS Administration window (View > REST Data Services > Administration). Right click on the REST Data Services and Connect to ORDS:

You'll see the current configuration.

In order to connect to the new database we need to add a Database. Right click in Database Settings and add a new database. Before writing it back (the icon with the green up arrow - click the Test Settings button first (the icon with a v) to make sure everything is fine.

Final step is to let ORDS know that if we put in our url /apex50 we want to connect to the new database. You can do that by adding an entry in URL Mapping:

That's it...

Note: sometimes I've issues with adding the database and URL Mapping in SQL Developer, but it's as fast to do it command line too. The doc has a great example which commands to run:

Step 4. Test

When you navigate to your normal url e.g. http://localhost/ords/f?p=ABC you will see your APEX 4.2 instance, but if you navigate to http://localhost/ords/apex50/f?p=ABC you'll see the APEX 5.0 instance.

You can play a bit more with making it nicer urls or do some redirects in Apache, but I hope you get the idea how to start testing APEX 5.0 while still running APEX 4.2 too.

Categories: Development

Announcement: APEX 5.0 UI Training - May 12th

Dimitri Gielis - Tue, 2015-01-27 13:27

APEX 5.0 will be released between now and the end of May. People who have already spent some time on the Early Adopter versions know this version is packed with new features aimed to make APEX developers even more productive, like the Page Designer.

Another striking new subset of features is aimed at creating better looking user interfaces for your APEX applications in an easy and maintainable way.

The definition of user interface components in APEX 5.0 is very different to what we're used to. For example there is a new Universal Theme with Template Options and a Theme Roller.

To get you up and running with this new toolset as quickly as possible, Dimitri Gielis of APEX R&D and Roel Hartman of APEX Consulting have joined forces and set up a one day course fully aimed at APEX 5.0 UI. So if you want to know not only how to use the new Theme, but also how to modify it to fit your needs, this is the event you should attend!

The training will be at the Mitland Hotel in Utrecht (NL) on Tuesday May 12.
More information and registration see

If you are from another country and think this training should be available in your country as well, please contact us - then we'll see what we can do!

Categories: Development

Free Version Control Tool for PL/SQL is now available for download

Gerger Consulting - Mon, 2015-01-26 01:57
We are pleased to announce that Gitora, the free version control tool for PL/SQL, is available for download.
Categories: Development

EM12c Filtering ORA-600 till the issue is resolved

Arun Bavera - Fri, 2015-01-23 15:22

Example alert recieved:
Target type=Database Instance
Target name=mydatabaseinstance1
Categories=Diagnostics, Fault
Message=Internal error (ORA 600 [kwqitnmphe:ltbagi]) detected in /opt/app/oracle/diag/rdbms/hogcprd/hogcprd1/alert/log.xml at time/line number: Sat Jan 17 22:53:57 2015/40570.
Event reported time=Jan 17, 2015 11:08:38 PM EST
Target Lifecycle Status=Production
Line of Business=IT
Operating System=Linux
Associated Incident Id=541447
Associated Incident Status=New
Associated Incident Owner=
Associated Incident Acknowledged By Owner=No
Associated Incident Priority=None
Associated Incident Escalation Level=0
Event Type=Metric Alert
Event name=adrAlertLogIncidentError:genericInternalErrStack
Metric Group=Incident
Metric=Generic Internal Error
Metric value=Errors in file /opt/app/oracle/diag/rdbms/xyxyx/xyxyxprd1/trace/hogcprd1_q002_31608.trc (incident=365969):~ORA-00600: internal error code, arguments: [kwqitnmphe:ltbagi], [1], [0], [], [], [], [], [], [], [], [], []
Key Value=Sat Jan 17 22:53:57 2015/40570
Key Column 1=Time/Line Number
Rule Name=OEM12c_ManagementAgentRuleset,OEM12c_Performance_metric_rule
Rule Owner=EM_ADMIN
Update Details:
Internal error (ORA 600 [kwqitnmphe:ltbagi]) detected in /opt/app/oracle/diag/rdbms/xyxyxy/xyxyxprd1/alert/log.xml at time/line number: Sat Jan 17 22:53:57 2015/40570.

New One:.*ORA-0*(54|1142|1146|600:.*\[kwqitnmphe[^\]]*\])\D.*

 Reference: EM 12c : How To Filter Specific ORA-00600 Error In Order To Avoid ORA-600 Alerts to be Raised In Console ? [ID 1592764.1]
Categories: Development

Customizing EM12c Email Format for Notification

Arun Bavera - Fri, 2015-01-23 15:16
Customization highlighted below:
-- Enterprise Manager Default Event Template

-- Subject of an e-mail is rendered in one line.
-- The resulting text from the following logic will be concatenated together into one line.

-- if this is a repeat email
-- show the repeat count

-- if it is an email for success or failure of corrective action
-- show the name and execution status of the corrective action
[ELSE] -- Regular email for metric alert
-- Show message if available


-- Enterprise Manager default template

 *****ITSM Please contact  [ORCL_GTP_DEPARTMENT]  Department for this Incident Alert******

-- if the email is for the status of corrective action
-- show the details of the execution of the corrective action

-- Source object name is the entity raising the issue.
-- Target name links to the respective target home page
-- in Enterprise Manager console



-- if it is a repeat email, show the repeat count
-- Event Dedup related Attributes


-- Root Cause Analysis details shows up when available. This is
-- normally applies to availability alerts for service targets

-- Check if any updates
Categories: Development