Browsing "Older Posts"

Set APEX application name for Dev, Test and Prod environment in the same database

Von Tobias Arnhold → 7.18.2018
In case you have a small application where development, test and maybe also production environment are on the same database and your applications in this environment distinguish only by the application IDs. To setup a custom application name based on the ID you could do like this:

We assume our application name is "Training room app" defined in the "Shared Components" > "User Interface Attributes"

To differentiate the environments I add a dynamic action "Page Load" on Page 0.
This dynamic action is executing custom Javascript code:

if ('&APP_ID.' == '200') {
  $('.t-Header-logo').find('span').html('Training room app - <b style="color:#008A34">Test Environment</b>');
else if ('&APP_ID.' == '300') {
  $('.t-Header-logo').find('span').html('Training room app - <b style="color:#9366a5">Development Environment</b>');

The code is changing the name of the logo area.


Copy and Paste to clipboard

Von Tobias Arnhold → 7.17.2018
Well I had the requirement to copy the content of a textarea into the clipboard. There are two ways to do that:

1. Build a dynamic action with custom Javascript code:
Copy Text to Clipboard

Code example - with dynamic action on "Click" and "Execute Javascript Code":
/* Select the text field */

/* Copy the text inside the text field */

2. Use an APEX plugin:
Copy to Clipboard (v1.1) - build by Dick Dral

Icons made by Vitaly Gorbachev from is licensed by CC 3.0 BY

Enable save button on form change

Von Tobias Arnhold → 6.28.2018
Today I had the requirement that the save button should stay disabled until a form item changed.

After digging around I found a quite easy solution which worked well until now.

Save Button
Static ID: saveBtn
Custom Attributes: disabled

Dynamic Action
Event: Page Load
Execute Javascript Code:
$('#wwvFlowForm').on('input change', function() {
    $('#saveBtn').attr('disabled', false);

Simple but effective.

Working with the APEX tree

Von Tobias Arnhold → 6.27.2018
Out of a coincidence I haven't used the APEX tree region for years. Now I got the task to create a customizable tree in my application. Since APEX 5 there is a new tree type called "APEX tree" which supports some really cool functions.

Anyway I had to look around to find out what the APEX tree is actually capable of. First of all start with the APEX "Sample Trees" application which you find in the packaged application area.

Morten Braten took that example and described the features really well:

John Snyders from the APEX team also created 2 blogposts about the "APEX tree":
APEX 5.0 Converting to the new APEX Tree
Add Checkbox Selection to APEX Tree Region

And as he mentioned there is a Javascript library behind it "libraries/apex/widget.treeView.js." which is documented since APEX 18.1 or at least I think it is. Anyway here is a link which I also have to further investigate:
JS Doc: Widget: treeView

German users can read this document provided by MT AG:

Check inside your APEX application if debug mode is enabled

Von Tobias Arnhold → 6.08.2018
Sounds like a simple task but whenever I have the requirement to add a region and make it conditional to check if APEX is running in debug mode. I always search for half an hour finding the right solution.

Search example on Google: "Oracle APEX check debug mode conditional PL/SQL"
Trying this or 30 different other ways it always ends up with the wrong results.

But it is so easy - Conditional PL/SQL Expression:

G_DEBUG returns true or false!
The documentation is a bit imprecise because it says 'Yes' or 'No'.

Anyway it is all well documented in the APEX documentation
> APEX_APPLICATION > Global Variables:

Join the NextGEN group at APEX Connect 18

Von Tobias Arnhold → 4.20.2018
The #NextGEN community is planning an after conference evening activity. For that reason we published a German article with all details on My dear friend Jonas translated the text via

Original article:
Wir sind EINE Community!

Here you go:


Young people who are motivated to get involved in conference planning? Yes, that's right!
And these motivated youngsters bring 24 more youngsters far away from the Oracle APEX universe.
Before the "older ones" among us now fall into shock rigidity - stay relaxed, because we need you!

These 24 students have no idea of our special APEX community.
It's up to us to take them along and show them how much fun, passion and action they can expect in APEX everyday life.

How do you recognize the students? 
Long hair, pale skin, no crutch... well, seriously: all students wear orange bracelets.

What do we expect from you?
Talk to the students! Don't just make them feel like they're in the community, but show them what it means to live the APEX community membership.

How do you do it best?
In addition to the conference and community evening on Wednesday, there are other networking opportunities:
For example, anyone interested can meet after the Speaker Reception on Tuesday at Schweinske (Bolkerstr. 28) from 8:30 p.m. in Düsseldorf's Old Town.
On Wednesday, after the official evening event at the Apollo Varieté, a joint visit to Club El Papagayo, which you can find at Mertensgasse 2 (both on a self-payer basis).

A tip: Give the poor students a drink - this will certainly increase their attention to want to know something about APEX! :slightly_smiling_face:

With these requests and advice we hope as NextGEN to bring the young savages together with the established community.

See you at APEX Connect!

Your NextGen team:

Abby, Caro, Rebecca, Davide, Jonas, Matthias, Philipp, Sebastian and Tobias


See on Tuesday! =)

CREATE or COPY master data pages in APEX

Von Tobias Arnhold → 3.07.2018
In this blog post I just want to give a hint about the positive and negatives effects when you COPY master data pages for different master data tables.

Both tables have the same columns :

In APEX you have a Master - Detail view including 2 pages: report view and modal dialog

If you decide to copy both pages you have to adjust the following things:
Master Data Report:
 - Page Name
 - Breadcrumb
 - Navigation Menu
 - Report DDL: Table Name
 - Report Column Link
 - Create Button Link

Modal Dialog:
 - After Header - Automatic Row Fetch (Name, Table Name)
 - Processing - Automatic Row Processing (Name, Table Name)
 - After Processing - Branch
 - APEX Items (in case you have different names or use prefixes)

What is the advantage?
1. Security
Security settings get copied like "Page Authorization Scheme". Master data pages normally apply to only one role, for example: administration
2. Labels and messages get copied (items, buttons). Really helpful if you named them differently to the standard APEX naming.

What is the disadvantage?
1. Linking
If you forget to change the branches/links then you could end up on the wrong page changing the wrong data. But on the other side this is the first thing you check after you finished the editing of the pages.
2. Automatic processing
If you forget to update the table names then you end up changing the wrong data.

It is a bit more risky to copy master data pages but it can save you a lot of time changing label names and to remember the security settings.

Interactive Report - Column background color

Von Tobias Arnhold → 3.01.2018
One of my customers needed an IR where half of the report columns should be visualized in another color.

It is really easy to integrate. Go into the report column attributes inside your "Page Designer" and add a "Static ID" for each column:

Column 1: rep_col_diffcolor_1
Column 2: rep_col_diffcolor_2

Now add this CSS snippet inside the page attributes:

.a-IRR-table tr td[headers*="rep_col_diffcolor_"]
    background-color: #99ccff;

The trick is to address every element by searching for the start part of the "Static ID" name.

APEX ist anders. Genau das gleiche gilt auch für die APEX Connect!

Von Tobias Arnhold → 2.27.2018
Es gibt zwei Dinge die ich in über 10 Jahren im Oracle Umfeld immer und immer wieder höre:

1. Die Community wird immer älter.
2. APEX ist aus Grund XY schlecht.

Was hat die APEX Connect damit zu tun?
Die APEX Connect beweist nun zum 4ten Mal, dass eine Community (wie die Technologie selbst) nicht stehenbleiben darf. Ohne die gemeinsame Arbeit an immer wieder neuen Angeboten wäre die Veranstaltung wohl nicht das was sie heute ist.

Deshalb gibt es dieses Jahr erstmals einen eigenen Track für Neueinsteiger, der von einigen DER APEX Experten präsentiert wird. Das bedeutet, Du bekommst als DOAG-Mitglied für 208 € nicht nur einen umfassenden Einstieg in die aktuelle APEX Version, sondern kannst Dir gleichzeitig noch die besten Tipps und Tricks vom Who is Who der Branche abholen.

Dabei ist es egal, ob Du Student, Azubi, ehemaliger DBA, Formsentwickler oder Quereinsteiger bist. Dieser Track ist für alle gleichermaßen perfekt geeignet: APEX for beginners am 24.04.2018

Ein eigener Newcomer-Track bedeutet aber noch viel mehr: Es öffnet die Tore für die neue Generation an APEX-Entwicklern.
Und hier ist die Community gefragt, denn neben den Studentengruppen, die über #NextGEN-Roadshows an den Universitäten bei der Connect teilnehmen, könnt ihr euren Auszubildenden oder Studenten für nur 340 € an allen drei Tagen der Konferenz inklusive Übernachtung und ÖPNV vor Ort teilnehmen lassen.

Wann gab es das schon mal, dass ein Oracle Event für die nächste Generation ein so vollumfängliches Gesamtpaket geliefert hat?
In 10 Jahren als Oracle Experte habe ich noch keines erlebt!

Nun zurück zum Anfang! Ich seh das so:
Die APEX und PL/SQL Community kämpft um die nächste Generation und bietet den kinderleichten Einstieg den es dafür braucht. Dazu gehört Mut, Begeisterung und Voraussicht. Dank dem Einsatz der DOAG, der #NextGEN-Community und den APEX Connect Verantwortlichen ist zumindest im Development-Umfeld der Verjüngungsprozess längst eingetreten.

Warum eine Technologie-Konferenz für einen jungen ITler so wichtig ist, beschreibt Carolin Hagemann:
"Ich selbst habe gerade am Anfang meiner APEX-Zeit als Student an der DOAG K+A teilgenommen. Neben den Erfahrungen persönlich mit den Referenten sprechen zu können (ich habe den "APEX-Raum" betreut) und direkt am Puls der Technologie sein zu können, hat mir gerade diese Zeit auch sehr bei dem Einstieg in die Community geholfen.
Und neben diesen doch eher weichen Faktoren gibt es durchaus auch andere Gründe an den Veranstaltungen teilzunehmen: Ist man erst einmal in dem Sog der APEX-Community gefangen, weiß man von den neusten Releases nur wenige Stunden nach der Veröffentlichung. Man profitiert von den Kontakten und bekommt auch schon einmal 20 Minuten nachdem man einem der APEX-Entwickler eine Frage gestellt hat, eine sehr ausgiebige Antwort ;) Das kann in vielen Situationen ein entscheidender Vorteil sein."

Jetzt seid ihr gefragt und gebt euren Azubis und Studenten die Möglichkeit teilzunehmen oder sponsert eine Wildcard, um ein neues Gesicht in unsere Community zu integrieren. Jeder der sich einmal mit dem APEX Virus infiziert hat, weiß wie schwierig es ist hiervon wieder los zu kommen. Also lasst uns gemeinsam möglichst viele neue Leute infizieren!

Danke an Carolin Hagemann und Matthias Nöll für deren wertvollen Input in den Artikel.

Werde Teil der NextGEN Community, dann schreibe einfach eine Mail an

Dynamic LOV with Pipeline function

Von Tobias Arnhold → 1.18.2018
A new year brought me some new tasks. I had to take over a generic Excel import and the customer wanted some extension by checking if the join on the master tables were successful.

Unfortunate we were talking about a generic solution which meant that all the configuration was saved inside tables including the LOV-tables which were saved as simple select statements.

Show all import rows/values which were not fitting towards the master data.

How did I fix it?

Source of LOV data:

Source of import data:

I made a little abstract data model so that you understand what I mean:
I have two tables "I_DATA" including the values from the import and "I_DYNAMIC_SQL" including the LOV statements.

-- ddl
   ) ;

   ) ;

-- data
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (1,'Jonas',1,'G1');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (2,'Sven',1,'G2');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (3,'Annika',1,'G3');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (4,'Jens',1,'G4');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (5,'FH Trier',2,'G1');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (6,'TH Bingen',2,'G1');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (7,'FH Trier',2,'G2');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (8,'TH Bingen',2,'G2');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (9,'Frankfurt UAS',2,'G3');
Insert into I_DATA (ID,DATA_VALUE,DYNAMIC_SQL_ID,DATA_GROUP) values (10,'TH Bingen',2,'G4');

Insert into I_DYNAMIC_SQL (ID,SQL_STATEMENT) values (1,'select d,r from (
   select ''Jonas'' as d, 1 as r from dual union all 
   select ''Sven'' as d, 2 as r from dual union all 
   select ''Jens'' as d, 3 as r from dual union all 
   select ''Annika'' as d, 4 as r from dual
Insert into I_DYNAMIC_SQL (ID,SQL_STATEMENT) values (2,'select d, r
from (
   select ''FH Trier'' as d, 1 as r from dual
   union all
   select ''TH Bingen'' as d, 2 as r from dual

It actually took some time to find a solution fitting my needs.
1. Fast
2. Easy to understand
3. Not tons of code

What I needed was some kind of EXECUTE IMMEDIATE returning table rows instead of single values. With pipeline functions I was able to do it:
create or replace package i_dynamic_sql_pkg as

  /* LOV type */
  type rt_dynamic_lov is record ( display_value varchar2(4000), return_value number );

  type type_dynamic_lov is table of rt_dynamic_lov;

  function get_dynamic_lov (
    p_lov_id number
  ) return type_dynamic_lov pipelined;

create or replace package body i_dynamic_sql_pkg as
  /* global variable */
  gv_custom_err_message varchar2(4000);

  /* Function to return dynamic lov as table */
  function get_dynamic_lov (
    p_lov_id number
  ) return type_dynamic_lov pipelined is

    row_data rt_dynamic_lov;

    type cur_lov is ref cursor;
    c_lov cur_lov;

    e_statement_exist exception;

    v_sql varchar2(4000);

    -- 'Exception check - read select statement';
    from i_dynamic_sql
    where id = p_lov_id;

    -- 'Exception check - result';
    if v_sql is null
      gv_custom_err_message := 'Error occured. No list of value found.';
      raise e_statement_exist;
    end if;

    -- 'Loop dynamic SQL statement';
    open c_lov for v_sql;
       fetch c_lov 
       exit when c_lov%notfound;

       pipe row(row_data);
    end loop;
    close c_lov;

  when e_statement_exist then
        p_message => gv_custom_err_message
      , p_display_location => apex_error.c_inline_in_notification
      raise_application_error(-20001, gv_custom_err_message); 
  when others then

Now I just had to create a SQL statement doing the job for me:
-- ddl
  /* check if a return value exist */
    when lov.display_value is not null
    then 'OK'
    else 'ERROR'
  end as chk_lov_data_row,
  /* apply error check for the whole group */
    when min(case
                when lov.display_value is not null
                then 1
                else 0
              end) over (partition by da.data_group)
        = 0
    then 'ERROR'
    else 'OK'
  end as chk_lov_data_group
from i_data da
/* Join on my pipeline function including the dynamic sql id */
left join table(i_dynamic_sql_pkg.get_dynamic_lov(da.dynamic_sql_id)) lov
on (da.data_value = lov.display_value)
order by da.data_group, da.dynamic_sql_id, da.data_value;