Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hierarchical Queries in Oracle

User_CCHZNJan 24 2022

Hi Friends
I have a table XXX and 2 columns are there. One of Item_ID and another column is Product_ID.
Below is the table data for those 2 columns. For example: I1 (Item1) is tagged with P1 (Product1) and P1 is tagged with I2 & I3 etc.,
I want to write the query to return all the rows if I pass the value as I1 in the SQL query. Because I1 is the root value for this data. Likewise query should work if we pass input as I2 and should return last 2 rows.
Table Data:
------------
Item ID-------> Product_ID
I1--------> P1
P1------> I2, I3
I2-------> P2, P3
P2------>I3, I4
.
.
.
etc.,

Comments
Post Details
Added on Jan 24 2022
2 comments
118 views