pls explain connect by prior with example and its real time
use
Answers were Sorted based on User's Feedback
Answer / anil kumar karasi
sql>Select rownum,rownid,level,empno,ename from emp
connect by prior empno=mgr where mgr is null;
o/p
Rownum Rowid Level empno ename
------ ----- ----- ----- -----
1 AABBBCCDA 1 5678 abcd
2 AABBBCCDB 1 9087 poiu
3 AABBBCCDC 2 8567 QWER
4 AABBBCCDD 2 7321 LKJH
5 AABBBCCDE 3 1284 ZXCV
For more details go through this link
http://www.psoug.org/reference/connectby.html
| Is This Answer Correct ? | 10 Yes | 1 No |
Connect by prior can be used to create heirarchical tree
structure
| Is This Answer Correct ? | 6 Yes | 3 No |
Answer / simi
CONNECT BY PRIOR is used for tree-structured queries.
I found a simple & useful explanation here:
http://www.oraclepassport.com
SQL - CONNECT By PRIOR Section
| Is This Answer Correct ? | 4 Yes | 2 No |
How to do a full database export?
 How to use an oracle sequence generator in a mapping?
What is a deadlock in SQL? How can you prevent it?
How to use fetch statement in a loop?
Explain self joins in oracle?
What are the Limitations of a CHECK Constraint ?
what is unique key?
14 Answers Amazon, Cap Gemini, Infosys, Wipro,
Please help me how to write a Query to change the primary key constraint from 1 attribute to another attribute in a table
What types of joins are used in writing subqueries?
How can you use check constraints for self referential integrity?
What is the relation of a user account and a schema?
what is the exact definition for pointer?