Hi All,
Oracle Database 18c.
I have hierarchical data in a table using the conventional recursive FK constraint like generated by the following SQL query:
WITH hier (child_id, parent_id) AS
(SELECT 1, null from dual union all
SELECT 2, 1 from dual union all
SELECT 3, 1 from dual union all
SELECT 4, 2 from dual union all
SELECT 5, 2 from dual union all
SELECT 6, 5 from dual)
SELECT * FROM hier;
The query output:

I want to produce the output as sys_connect_by_path does, but in a row-centric way as shown below:

So every node_id in the output has complete hierarch in hier_node_id column as set of rows.
Any idea on how to do this using single SQL statement?
Your help will be very much appreciated.
Many Thanks and
Kind Regards,
Bilal