Home » SQL & PL/SQL » SQL & PL/SQL » Display Oracle Data in Hierarchical format (Oracle10g)
Display Oracle Data in Hierarchical format [message #410146] Thu, 25 June 2009 08:13 Go to next message
mmunirahmad
Messages: 2
Registered: June 2009
Location: Canada
Junior Member

Hi,

I would like to display Oracle 10g data in hierrachical format like:

Category
....SubCategory
......Brand
..........PormotedGroup
.............Product

I have an Oracle table with all of above fields. Can you please tell me which oracle 10g funcion or query should I use to display this data in the format above.

I just want to use either SQL or PL/SQL.

Thanks
MM
Re: Display Oracle Data in Hierarchical format [message #410160 is a reply to message #410146] Thu, 25 June 2009 08:58 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
You could use LPAD the way it is used here in the SYS_CONNECT_BY_PATH example.

Re: Display Oracle Data in Hierarchical format [message #410166 is a reply to message #410160] Thu, 25 June 2009 09:11 Go to previous messageGo to next message
mmunirahmad
Messages: 2
Registered: June 2009
Location: Canada
Junior Member

Thanks, you are right but the example is for one column only.
I would like to display multiple columns in hierarchical format.

Thanks
MM
Re: Display Oracle Data in Hierarchical format [message #410168 is a reply to message #410166] Thu, 25 June 2009 09:15 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Then adjust the query accordingly. Select each column with the appropriate LPAD.

We can't see what data you have, so if you want a more detailed answer you will have to provide a test case according to the forum guide. (CREATE TABLE and INSERT statements that re-create the data you have)

Re: Display Oracle Data in Hierarchical format [message #410186 is a reply to message #410166] Thu, 25 June 2009 10:25 Go to previous message
Michel Cadot
Messages: 68734
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Post a working Test case: create table and insert statements along with the result you want with these data.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Previous Topic: get the name of the column being updated by query
Next Topic: how to use the new_value to pass the variable
Goto Forum:
  


Current Time: Wed Feb 12 05:54:37 CST 2025