After digging out we will find numerous similar questions, I can systemtically state the answer as follow:
1. In order to transpose columns to rows, you may use UNION ALL
here
2. In order to apply PIVOT table you should consider oracle version as follow:
a. Oracle 11g: You can use Built In PIVOT Feature and here
b. Oracle 10g and 9i: You are restricted to use [CASE WHEN][4]
expression or [DECODE][5]
expression.
c. Oracle 8i: You are restricted to use DECODE
expression
For my question above, I found the solution as follow:
SELECT uom.code,
MAX(CASE WHEN l.language_id = 25 THEN uomt.description ELSE NULL END) AS english,
MAX(CASE WHEN l.language_id = 22 THEN uomt.description ELSE NULL END) AS german
FROM unit_of_measure uom
INNER JOIN unit_of_measure_trans uomt
ON (uom.unit_of_measure_id = uomt.unit_of_measure_id)
INNER JOIN language l
ON (uomt.language_id = l.language_id)
WHERE l.language_id IN (25, 22))
GROUP BY uom.code;
Notice that in CASE WHEN
expression, if you do not use aggregate function you'll get error unless you remove GROUP BY
expression. However, in the later case, you'll get all null values which is rarely useful result