14. Odds 'n' Ends
Transposing a Result Set Using Oracle’s MODEL Clause

select max(d10) d10,
max(d20) d20,
max(d30) d30
from (
select d10,d20,d30
from ( select deptno, count(*) cnt from emp group by deptno )
model
dimension by(deptno d)
measures(deptno, cnt d10, cnt d20, cnt d30)
rules(
d10[any] = case when deptno[cv()]=10 then d10[cv()] else 0 end,
d20[any] = case when deptno[cv()]=20 then d20[cv()] else 0 end,
d30[any] = case when deptno[cv()]=30 then d30[cv()] else 0 end
)
)Extracting Elements of a String from Unfixed Locations


Finding the Number of Days in a Year (an Alternate Solution)

Searching for Mixed Alphanumeric Strings
Converting Whole Numbers to Binary

Pivoting a Ranked Result Set




Adding a Column Header into a Double Pivoted Result Set

Parsing Serialized Data into Rows



Calculating Percent Relative to Total

Last updated