Skip to Main Content
  • Questions
  • Creating hierarchy using a parent child table

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question.

Asked: May 22, 2025 - 5:48 pm UTC

Last updated: June 10, 2025 - 2:16 pm UTC

Version: 19c

Viewed 1000+ times

You Asked

hello guys,

I'm trying to create hierarchy using a parent child table for analytic view but I'm struggling.

the steps:

1. create a attribute dimension using the table --> (id,name,parent_id)
(I succeeded but idk the correct way for the parent child hierarchy).

2.create a hierarchy using the attribute dimension from previous step,
(i succeeded to create a regular hierarchy that isn't based on parent child)
idk how to do it, tried 3 chatbots and also oracle docs with no answer.


im doing this on toad 19 - oracle 19
hope someone can help me.

thanks!

and Chris said...

It appears that you want to build a hierarchy using a parent-child relationship across rows. For example, company org charts (manager -> employee) or bill of materials product hierarchies.

This is NOT how analytic view hierarchies work!

These are defined across columns within a row. The classic example is date components, e.g.

Day -> week -> month -> year (e.g. Day 10 -> Week 24 -> June -> 2025)

Which could be based on a table like

create table dates ( day int, week int, month varchar2(10), year int )


So to use analytic views, you need to pivot the data into a table with a column for each level in the hierarchy.

Post more details about your use case and provide examples (create table, insert into), and we'll do our best to help.