Recent Posts

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.

Goal:
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
  CREATE TABLE "I_DYNAMIC_SQL" 
   ( "ID" NUMBER NOT NULL ENABLE, 
 "SQL_STATEMENT" VARCHAR2(4000), 
  CONSTRAINT "I_DYNAMIC_SQL_PK" PRIMARY KEY ("ID")
  USING INDEX  ENABLE
   ) ;

  CREATE TABLE "I_DATA" 
   ( "ID" NUMBER NOT NULL ENABLE, 
 "DATA_VALUE" VARCHAR2(1000), 
 "DYNAMIC_SQL_ID" NUMBER, 
 "DATA_GROUP" VARCHAR2(20), 
  CONSTRAINT "I_DATA_PK" PRIMARY KEY ("ID")
  USING INDEX  ENABLE
   ) ;

-- data
REM INSERTING into I_DATA
SET DEFINE OFF;
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');

REM INSERTING into I_DYNAMIC_SQL
SET DEFINE OFF;
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;
end;

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);
  begin

    -- 'Exception check - read select statement';
    select 
       max(sql_statement)
    into
       v_sql
    from i_dynamic_sql
    where id = p_lov_id;

    -- 'Exception check - result';
    if v_sql is null
    then
      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;
    loop
       fetch c_lov 
       into 
         row_data.display_value,
         row_data.return_value;
       exit when c_lov%notfound;

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

  exception
  when e_statement_exist then
      rollback;
      /*
      apex_error.add_error(
        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
      raise;
  end;
end;

Now I just had to create a SQL statement doing the job for me:
-- ddl
select
  da.data_group,
  da.data_value,
  /* check if a return value exist */
  case
    when lov.display_value is not null
    then 'OK'
    else 'ERROR'
  end as chk_lov_data_row,
  /* apply error check for the whole group */
  case
    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;

Result:

After the party is before the party

Von Tobias Arnhold → 10.20.2017
Now two months after the #pougtrip everything went back to normal. Except the planning for the next events.

The DOAG #NextGEN is currently starting a "roadshow" at German universities.

Start is the 07.11.2017 at the Trier University of Applied Sciences. We will have 3 presentations covering different technologies: SQL, JS, JSON, SVG, PL/SQL, REST and APEX.
But see for yourself: Oracle Vorträge an der Hochschule Trier


As you can see the agenda is made with APEX :). Inspired by the #pougtrip we plan free beer for all students!

This is our first test run to find out what it takes to get as much students as possible to listen to Oracle related technologies.

From my perspective the question is: What can an Oracle expert contribute to young professionals?

For example: handling real life problems and sharing the experience while using modern technologies. But I think most important is devotion.
You get inspired by an expert mostly depending on how dedicated this person is delivering the information. This event gives us the chance to inspire young professionals to see Oracle in a new light. See the possibilities and feel the devotion by the people who are working with the technology.

BTW: This event wouldn't be possible without two dedicated students. Thanks Rebecca and Abby!

The best Oracle technology week ever - Part 1: Helsinki and Stockholm

Von Tobias Arnhold → 9.07.2017
You remember my last blogpost describing how my #europeTour would be like:
#orclapex Europe tour 

It was a week with as little sleep as possible. Reasons:
 - traveling
 - just was to excited
 - to much party

It all started in Helsinki with the first Oracle APEX day in Finland.
I reached Helsinki with Richard Rieb around 10 o'clock in the evening. It was dark and cold, our taxi driver spoke 5 words to us but good hard rock music was played on the radio. We knew we have come to the right place.
At the next day we met the organizers (Heli and Marko), the other speakers (Carsten Czarski, Shakeeb Rahman, Matthias Nöll and Mathias Magnussen) and 30 other APEX interested people.
I was happily surprised to meet Matt Nolan from the FOEX crew.
Background story: This guy gave me, in hard times maybe 8 years ago, some good tips and kept my APEX passion alive.
I was even more surprised to meet Jari Lainen which created a really nice APEX example application and has an awesome blog as well. He mentioned to join a new APEX project soon. He will hopefully start writing then again.

The presentations were really good but see for yourselves:











Btw: If you think I do crazy stuff then I always find someone even more devoted like Heli who flew to Soul for the Oracle code conference in between the Finnish APEX event and the POUG in Krakow.

We the other presenters, except Mathias who had to fill the time gaps in between the conferences, took the cruiser ship to Stockholm.


Funny fact: beer at the bar was 6 €, one beer at the tax free shop costs 3,50 € and 24 for of them in a pack costs 20 €. You know what we did.

We enjoyed beers in a stormy night at the railing watching the ocean.
Tip: On a shaky boat just drink 5 beers and feels like you have drunken 10.

In Stockholm we got the perfect location including really tasty food during the first Oracle APEX day in Sweden. 60 participants were listening to our presentation. See for yourselves:










We got great feedback by the customers and enjoyed several nice talks. I even talked to a guy from Denmark who just came to participate at this particular conference. Thanks to the Swedish Oracle Usergroup (SWEOUG) making it possible. My special thanks goes to Daniel and Mathias.

We spent the night by my relatives as Richard discoverd that one of the beers got broken and drenched his backpack. :D Luckily he flew home the day after.

Next Morning at 5 o'clock we (Matthias and me) headed towards the Arlanda airport and took the flight to Berlin.
In Berlin we met the students for the "NextGEN goes POUG trip" (#pougtrip)

In case you want to look at all the tweets from the conference then search for #europeTour, #sweougApex17 or #orclapex.

Next time I will tell you all about the trip to the "POUG 2017". :) Look closely at the DOAG website.

#orclapex Europe tour

Von Tobias Arnhold → 8.16.2017
From Tuesday, the 29. of August until the 02. September, I will meet the best experts around Oracle.





But first some background:
Last year I was in Sweden and held a presentation at a meetup in Stockholm about APEX. I met Mathias Magnusson an Oracle specialist who is organizing all kinds of Oracle usergroup events in Sweden. I was lucky to meet him again at DOAG 2017 and introduced him to Joel Kallman. During the discussion came the idea to make an APEX day in Sweden. Mathias prepared everything and invited some well-known experts who may join the party as speakers. In the email, he also was asking Heli Helskyaho. She is one of the world most known speaker about Oracle related technology at the moment.
She liked the idea to join in and asked if we could combine it. One event in Helsinki (Finland) and one in Stockholm (Sweden). And that is not all. Mathias put the date of the event shortly before the POUG in Poland. Conclusion: My Oracle #orclapex Europe tour was set up.
Out of my perspective the Nordic APEX days should look like this: 
We need to show the people what APEX can do and how it is used in production. If an Oracle employee or a consultant is talking about how great the tool is then maybe not everyone will believe it. So, I asked the experts from Deutsche Bahn (SmallSolutions-Team) to join the party and they did!

So, this is what happens now:
    1. Monday I will fly to Helsinki with Richard from Deutsche Bahn. Last preparations with Matthias and Richard (SmallSolutions-Team) for the event.
    1. Having the Oracle/Miracle APEX-Day in Helsinki (Finland): Oracle / Miracle APEX - Day
      1. Including nice talks with Heli, Carsten, Shakeeb and hopefully a lot of APEX interested end users.
    1. After the day we will take the cruiser ship over night to Stockholm including some drinks and talks and "Finnish Tango".
    1. Having the SWEOUG APEX day in Stockholm (Sweden): #SweougApex17
      1. Including nice talks with Patrick, Mathias and hopefully a lot of APEX interested end users. Hopefully a couple of beers in the evening.
    1. Next morning take the plain to Berlin and preparing with Matthias (Small Solutions-Team) for POUG
    1. Meet the students at Berlin main station and take the rented bus to POUG in Kraków.
    1. Getting to know the student group including some activities during the bus trip.
    1. Hotel check-in and dinner with the students
    1. POUG conference starts: #POUG17
      1. Including to meet the best Oracle database experts and get the students to meet them and drink a few beers with Kamil.
    1. POUG Party
    1. POUG conference second day
    1. Evening dinner and taking the bus home
Let me say it in short words:
3 conferences, holding 3 presentations, meeting lots of experts and meeting even more new faces!

In case you are curios and want to get to know the flair from the conferences then follow me at Twitter: @tobias_arnhold / #APEXgoesEurope / #pougtrip / #SewougApex17 / #orclapex

I will write as I have never written before. :)

DOAG #NextGEN goes POUG

Von Tobias Arnhold → 7.15.2017
Hallo liebe Oracle Community,

die letzten Wochen und Monate waren etwas sehr hektisch, daher hatte ich auch keine Zeit für Blogposts rund um Oracle und APEX. Der Grund lag in meiner Aktivität in der DOAG #NextGEN Community. Wir als Community planten ein Studenten- und Azubi-Event für Oracle Technologien.

Das Ergebnis ist eine Reise zur POUG nach Krakau.


Mit dabei sind die bekanntesten Oracle Speaker aus ganz Europa.


Und genau dieses Event, das sich so drastisch von allen anderen Oracle Community Events in Europa unterscheidet, möchten wir nutzen, um den Studenten einen Einblick in die DBA- und Development-Community zu geben.

Gemeinsam mit der DOAG haben wir so den POUG Trip: DOAG #NextGEN goes POUG auf die Beine gestellt.


Wir planen, mit einem Bus von Berlin aus nach Krakau zu fahren. Unsere Gruppe wird aus 20 Studenten, Azubis und einigen DOAG Community Mitgliedern bestehen. Aktuell suchen wir noch nach 3-4 Sponsoren, die bei diesem Event mit machen möchten. Es geht darum, einem Studenten oder Auszubildenden diese Reise kostenlos zu ermöglichen, um mit deren Hilfe die Oracle Community auch jüngeren ITlern wieder näher zu bringen. Wir hoffen natürlich auf einen viralen Effekt und wollen rund um das Event so viel Lärm wie möglich machen, damit alle von unserer aktiven Community erfahren.

Ihr habt selbst Studenten / Azubis die im Oracle Umfeld tätig sind? Dann sollen diese sich einfach anmelden, um so die Chance zu erhalten, eine der begehrten Wildcards zu bekommen. Die Konferenz ist international aufgestellt, und fast alle Vorträge werden auf Englisch gehalten.

Ich kenne viele in der Community, die sich auch privat an solch einem Event beteiligen würden, daher mein Vorschlag: Rottet euch zusammen und einer meldet sich dann bei der DOAG als Sponsor an.
Denn wenn jeder einzeln kommt, dann steigt mir die DOAG wahrscheinlich aufs Dach. :)

Ps.: Die Kosten für einen Studenten betragen 600 € (beinhaltet Reise, Hotel, Ticket, Verpflegung).

Bei Fragen steht die DOAG gern bereit, diese zu beantworten: +4970011362438


Danke schon mal vorab für eure Hilfe!

APEX CONNECT and POUG High Five

Von Tobias Arnhold → 5.03.2017
Next week the APEX CONNECT 2017 will start. Besides the latest News about Oracle APEX you will have the chance to talk to some of the best developers worldwide.
As I mentioned at the beginning of the year "A new year promises new possibilities!" I'm focusing on students and will hold a presentation about "Next Generation - Erreiche die Mitarbeiter von Morgen".
Besides that I'm always willing to help others so if you have questions don't hesitate to talk to me. I will take the time to listen to your APEX related problem and may be able to help you or guide you a way to success. You know the best thing on conferences is to meet new people.

The other real highlights for me are:
1. Meet the Oracle APEX developers in person.
You need some good APEX related advice then talk to them they wont bite you. :) I'm especially looking forward to talk to Joel Kallman.

2. The hidden jewels besides the keynotes
- APEX / JavaScript / UX / SQL / PLSQL Q&A Panel (Wednesday)
- 1:1 Gespräche - Ask the Oracle Experts (Thursday)

3. Deutsche Bahn is looking for you.
If you searching for a new challenge as an APEX developer and/or project manager then talk to the "Small Solutions" team from Deutsche Bahn. They are searching for more experts and have their own stand at APEX CONNECT.

And after that...



I prepare myself for the most community driven Oracle conference on the planet.

The best known DBA's and developers from all over Europe come to present at the event. They pay for themselves just to be there. Why? It's the common passion which they can't get anywhere else in this concentrated form. I'm happy to be there as well and I will hold the only APEX related presentation. All presentations are held in English. Everyone is welcome to join this amazing event!

JET pie chart in APEX with absolute numbers as data labels

Von Tobias Arnhold → 5.02.2017
The new APEX pie charts only allows percent values as data labels. Luckily the APEX team added an great example in the "Sample Chart" application which shows how to add custom data labels including absolute values by adding custom JavaScript code.

For German applications I prefer to display 10k (10000) like this: 10.000.
Thanks to APEX and JET it is easy to implement.

function( options ){
    this.donutSliceLabel = function( dataContext ){
        var value_ger;
       
        value_ger = dataContext.value.toLocaleString('de-DE', {
                      minimumFractionDigits: 0
                    });
       
        return value_ger;
    } 
    options.dataLabel = donutSliceLabel;
    return options;
}



Info: Technical updates in the JavaScript area are not supported by APEX updates. For example: A future JET version could have some engine changes which will not accept my JS example anymore.