HIER_ANCESTOR returns the ancestor at a particular level of a hierarchy for either all members in the hierarchy or a particular member. The hierarchy must be level-based.
VARCHAR2
HIER_ANCESTOR( [ member [WITHIN] ]
dimension | hierarchy
LEVEL level )
member is a value of hierarchy whose ancestor is calculated. Otherwise, the ancestor 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.
level is the level of the ancestor.
The following example returns the ancestor at the Quarter level for members of the Calendar hierarchy.
HIER_ANCESTOR(GLOBAL.TIME LEVEL GLOBAL.TIME.CALENDAR_QUARTER)
| Member | Quarter |
|---|---|
| 2003 | null |
| Q1-03 | Q1-03 |
| Q3-03 | Q3-03 |
| Mar-03 | Q1-03 |
| Jul-03 | Q3-03 |
The next example returns the ancestor at the Fiscal Quarter level for Jul-03.
HIER_ANCESTOR('Jul-03' WITHIN GLOBAL.TIME LEVEL GLOBAL.TIME.FISCAL_QUARTER)
| Member | Quarter |
|---|---|
| Jul-03 | FY-Q1-04 |
Copyright © 2003, 2007, Oracle. All rights reserved.