It's a variation on a "pivot" table:
http://asktom.oracle.com/pls/ask/f?p...:766825833740,