Archive for September, 2007
The Oracle 11g UNPIVOT operator – turning columns into rows
Sep 30th
The PIVOT operation is one frequently discussed when talking about more advanced SQL Queries. Pivoting is the process of switching rows and columns, and is for example an advanced feature in Excel. Before Oracle 11g, there were several approaches to pivoting, that were not work-arounds for the lack of the PIVOT operator in the Oracle SQL Language.
With Oracle 11g, this has changed. Now we do have a PIVOT and an UNPIVOT operator at our disposal. Let's first take a look at UNPIVOT. In Oracle, the UNPIVOT operation is the process of turning Columns to Rows. Put simply, by applying the UNPIVOT operator to a number of columns, every row is split into that same number of rows. Each of these rows has two new columns: one for the column that this row stems from – one of the columns the data set was UNPIVOTed by – and one with the value from the column. The original UNPIVOT-columns are no longer part of the newly created records.
Let's take a look at a simple example, using the well known EMP table. We decide to consider the SAL and COMM columns as two different types of INCOME_COMPONENT. We would like to present our employees with an INCOME_COMPONENT column – and two rows for each employee with two income components.
This UNPIVOT query would look like this:
select *
from ( select ename, job, sal, comm
from emp
)
unpivot
( income_component_value
for income_component_type in (sal, comm)
)
/
DBMS_COMPARISON – to compare and synchronize tables (new in Oracle 11g)
Sep 30th
One of the interesting new pieces of functionality in Oracle 11g is offered by the DBMS_COMPARISON package. This package allows us to compare two tables – or two views on tables – and inform us on the differences in data. More specifically: the package can summarize if there any changes between the data sets and if so how many. It can also inform us in detail about the specific rows that are different between the two. Finally, DBMS_COMPARISON can converge the data sets, taking one of the two as the master and fully aligning the other one. Using DBMS_COMPARISON, we get on-demand replication for ordinary tables, within schemas, across schemas or even across databases.
In this article, I will demonstrate – on the 11.1.0.6 (Beta) release for Windows – how I can compare table EMP with a clone, whose data has been modified. We will then see how we can re-align the clone with the original (master) table. In this example, I work within a single schema. However, everything I do can be done across schemas and even across a database link, catering for custom data replication scenarios.
Here is our challenge:
Read the rest of this entry »
MOOW 2K7 – The Miracle Express
Sep 26th
It’s the day before Miracle Oracle Open World 2007. Tomorrow the (Dutch) Miracle Express will leave and will make its way from Garderen to Lalandia, Denmark. Hopefully arriving with all its Dutch passengers still intact and conscious after a long trawl on the Dutch, German and Danish highways to find its final destination, Miracle Oracle Open World…
Read the rest of this entry »
Battle of the Geeks 2007 – An eyewitness report
Sep 26th
Yesterday I attended the Battle of the Geeks. It was hosted by Finalist at the Netherlands Architecture Institute in Rotterdam. There were four presentations about different subjects. CMS Container, Google Guice, Gruby on Grails and Mule. A former colleague of mine (Peter Maas) was giving the presentation about Groovy and Grails. At the end of every presentation we had to rate the presentation (1-5 stars). The presentation with the best rating was rewarded with the battle of the geeks award, a plastic viking helmet and a paper with the name of the speaker on it.
Read the rest of this entry »
How to Unit-test private methods
Sep 24th
I know it’s kind of wrong to test private methods and there are a lot of articles and books that will explain you why. But sometimes you have an old code base where you have to unit-test some private methods to speed up development time. Today I got such a code base. It’s wasn’t that old, but I needed to change a private method that was called by some other methods. Those other methods had some parameters that needed to be set up depending on the user and the actions that user took in the application.
The trickle-feed integration pattern
Sep 23rd
This pattern was ‘invented’ by our SOA-architects team integrating the Oracle SOA Suite and the Oracle e-Business Suite in an existing IT-landscape.
The trickle-feed integration pattern can be used when
distributed systems integrate with one another by means of asynchronous messaging.
The messages are versioned to each other in such a way that the newest version may
only be processed by the receiving system after all older versions of
that message are successfully processed. The trickle-feed mechanism is
responsible for the correct processing order of messaging between all message
versions. The mechanism keeps track of the already send versions and will send
out only the correct version to the distributed system on a trickle-feed basis,
while keeping other versions on a stack until they are ready to be processed
Read the rest of this entry »
ADF – Using CSS to change the appearance of mandatory items (dump the asterisk)
Sep 20th
One of our ADF projects has a customer determined to develop an application with a modern, appealing user interface. To that end, they hired a User Interaction Designer, who did a great job of creating a consistent UI design with very attractive pages indeed. Now it is up to us to actually implement the design using ADF and a fair bit of Skinning and Styling.
One very specific requirement was that the application would not use the well known asterisk to indicate required items – like this:
but instead indicate mandatory items using a subtle red marker at the far right side of all required input items – like this:
Always an interesting challenge…
Read the rest of this entry »
Importing Access applications into Apex
Sep 19th
Some time ago I’ve been experimenting with the Apex 3.0 feature that migrates entire Access applications to Application Express. It took me a lot of time because I found out the path to it is winding and bumpy. I would like to share some of my issues here. A very good tutorial is found at Oracle’s OTN site (which I partially used).
For the experiment, I used a real-life Access database, so not the straightforward Northwind database that Microsoft supplies with Access. Most of the steps are done with SQL Developer 1.2. I used Apex 3.0.
Read the rest of this entry »
Check out the Apex 4.0 preview at Carl Backstrom’s blog!
Sep 18th
The live demo presented by Carl Backstrom as presented to the attendees of the Apex European Training Days is now publicly available!
You can review at Carl’s blog , and if you got a few minutes spare time, you should take a look. I think the reporting features of Apex 4.0 are simply jawdropping. The out of the box rich client functionality will make very attractive and versatile reports, with end-user sorting, filtering (including more complex filters and sorts), and the ability for the end-user to store a certain ‘view’ on those reports for later use.
I read Oracle’s Statement of direction, where is mentioned what is in store for version 4.0. My guess was that a lot of Javascript can be generated in the future, for instance for client-side validations and calculations on form-items. Possibly some of the third-party functionality like Google Suggest and the Yahoo User Interface library might be delivered out-of-the-box. Looking again at the SOD, I think that is summarized mainly in the ‘declarative support for AJAX validations’, as well as in the ‘Improved tabular forms, including support for validations, integration with collections, and additional item types’. We might expect a huge productivity boost here. Another reason not to think of Apex as just another reporting tool, but more like a full-blown development environment.
My hope is that release 4.0 will be there somewhere in the first quarter of 2008. What I did hear is that 3.1 is expected to be released this month, with, as stated in the SOD, Documented and supported Application Express JavaScript libraries. The devteam has been working hard to update the documentation for this part.
GlassFish V2/9.1 FCS has been released
Sep 18th
GlassFish is the first open source application server to have implemented the JEE specification. Basically it is the open source version of Sun Java System Application server. Last night I received an email from the users mailinglist of the GlassFish project that the second release of GlassFish has reached FCS status. Two major changes as compared to the V1 are
- Implementation of JSF 1.2
- The possibility to run GlassFish as a cluster
as well as many bug fixes. Please have a look at the download page for more info.


