Solved

SQl Connect by

Posted on 2011-03-10
1
237 Views
Last Modified: 2012-05-11
Hi,
Attached contains the output of the query and sql. I would like my out put to be like below..All continenets should be below a static text"WORLD". Please let me know how can I do it. Please let me know if this is not clear.

table-export.xls
0
Comment
Question by:Sthokala
1 Comment
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 35096346
Try this
select asid,name from
(
select 1 sortorder, 0, asid, 'WORLD' name from dual
union all
SELECT 2, a.id AS
id,
  lpad(' ',  (LEVEL -1) *4,   '-') || a.name as Name 
FROM ref_region a START WITH a.containingregion IS NULL CONNECT BY PRIOR a.id = a.containingregion
)
order by sortorder, name

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now