HIER_TOP returns the topmost ancestor of either all members of a hierarchy or a particular member. The hierarchy can be either level-based or value-based.
VARCHAR2
HIER_TOP ( [ member [WITHIN] ]
dimension | hierarchy)
member is a value of hierarchy whose top ancestor is calculated. Otherwise, the top ancestors of all members of the hierarchy are calculated.
dimension is the dimension whose members are used in the calculation.
hierarchy is a hierarchy of dimension. Otherwise, the default hierarchy is used.
The following example returns the top member of the Calendar hierarchy for all members in that hierarchy.
HIER_TOP(GLOBAL.TIME.CALENDAR)
| Time Member | Top Member |
|---|---|
| 2002 | 2002 |
| Q3-02 | 2002 |
| Jul-02 | 2002 |
| 2003 | 2003 |
| Q3-03 | 2003 |
| Jul-03 | 2003 |
The next example returns the top member of the default Fiscal hierarchy for Jul-03.
HIER_TOP('Jul-03' WITHIN GLOBAL.TIME)
| Time Member | Top Member |
|---|---|
| Jul-03 | FY-04 |
Copyright © 2003, 2007, Oracle. All rights reserved.