473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Equivalent of Hierarchy SQL in Oracle

Hi All,

We have some performance issues with 'CONNECT BY PRIOR' SQL statement and trying to find an alternate SQL which gives the same output.

Example:
ENum-----------------Mgr
Julie
Andrew---------------Julie
Mark-----------------Andrew
Matt-----------------Andrew
Wyatt----------------Julie
Jenny----------------Wyatt

SELECT enum, mgr FROM <table> START WITH enum IS NULL
CONNECT BY PRIOR enum = mgr;

Output:
-------
Julie
---Andrew
------Mark
------Matt
---Wyatt
------Jenny
---Joel

How do I get the same output without using CONNECT BY PRIOR command. I dont mind creating a new table that will keep all the possible combinations between enum and mgr columns.

Please provide your solution. I really appreciate it.


Thanks in advance,
Rao


--
Rao V Chenna
Feb 17 '06 #1
1 4526
salix
1
Hi All,

We have some performance issues with 'CONNECT BY PRIOR' SQL statement and trying to find an alternate SQL which gives the same output.

Example:
ENum-----------------Mgr
Julie
Andrew---------------Julie
Mark-----------------Andrew
Matt-----------------Andrew
Wyatt----------------Julie
Jenny----------------Wyatt

SELECT enum, mgr FROM <table> START WITH enum IS NULL
CONNECT BY PRIOR enum = mgr;

Output:
-------
Julie
---Andrew
------Mark
------Matt
---Wyatt
------Jenny
---Joel

How do I get the same output without using CONNECT BY PRIOR command. I dont mind creating a new table that will keep all the possible combinations between enum and mgr columns.

Please provide your solution. I really appreciate it.


Thanks in advance,
Rao


--
Rao V Chenna
Hi
How many rows do you want select ? In one task use hierarchy query for the 40 - 60 thousand rows without any problems.
Jul 26 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JBBHF | last post by:
Hi i'm working on a web project, and i would like to make my oracle query work in mysql. select match.numero "nummatch", to_char(match.datematch, 'yyyy-MM-dd') "datematch", p1.numjoueur "j1",...
2
by: gimme_this_gimme_that | last post by:
Assuming data is being stored in a DB2 TIMESTAMP what is the equivalent of Oracle's to_date function : to_date('03/04/2005','MM/DD/YYYY') It's OK if MM/DD/YYYY is the only supported format....
8
by: gimme_this_gimme_that | last post by:
Is there something equivalent to Oracle's SELECT DBMS_LOB.GETLENGTH(COLUMN_NAME) FROM FOO where COLUMN_NAME is a CLOB in table FOO returning an integer with a count of the number of...
14
by: hilz | last post by:
Hi all, What is the equivalent of VARCHAR2 in access? thanks hilz
2
by: Do | last post by:
Hi, I have a database table with the following fields: id, name, parentid. These fields are supposed to create a hierarchy for a list box, an infinite hierarchy Child fields of parent fields...
0
by: Doug Bloebaum | last post by:
In Oracle I can do this: SELECT h.transaction_number CURSOR(SELECT d.detail_number FROM detail d WHERE d.transaction_number=h.transaction_number) FROM header h WHERE...
7
salesmr
by: salesmr | last post by:
I have a query that works fine in Oracle, but I can't seem to get it to work in PHP. The code is: $query = "SELECT lpad(' ', (level - 1) * 4) || emp_name, level "; $query .= "from emp_table";...
2
by: ghe | last post by:
Good day to all, Does anyone here know how to convert the specified Oracle code below into PHP? Oracle Code: TYPE myTable IS TABLE OF varchar2(1) INDEX BY BINARY_INTEGER; If the Oracle code i...
1
DTV12345
by: DTV12345 | last post by:
Greetings! Imagine 2 hosts: host A runs Oracle 10g , host B runs IBM DB2 v9. I have to write a shell script (bask/Korn...) that checks if a database instance is up and running and does a bunch...
0
by: kg6ypx | last post by:
Greetings! Imagine 2 hosts: host A runs Oracle 10g , host B runs IBM DB2 v9. I have to write a shell script (bask/Korn...) that checks if a database instance is up and running and does a bunch...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.