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 |
What is clustered table in Oracle?
What is a parameter file in oracle?
How to rebuild an index in oracle?
How do I spool to a csv formatted file using sqlplus?
Does oracle partitioning improve performance?
How to write an inner join with the where clause in oracle?
what are the advantages of running a database in NO archive log mode?
what are the mandortary parameters required for cuncurrent program definition in oracle apps R12?
If youre unsure in which script a sys or system-owned object is created, but you know its in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer?
Is there any function in oracle similar like group_concat of mysql?
what is mean by prmary key and foreign key and how can we diffrentiate that? Please answer me. Advance thanks.
write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 I want the output format like following empid,sal,composite_sal 101 1000 1000 102 2000 3000 103 3000 6000