469,328 Members | 1,237 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

What is connect by prior?

hi
i need answer for one question


what is connect by priority? which trigger can be used for this ?
May 8 '07 #1
7 21962
debasisdas
8,127 Expert 4TB
Connect by priority ?

What is that ??

Is it in Oracle ???
May 8 '07 #2
debasisdas
8,127 Expert 4TB
If you are talking of CONNECT BY PRIOR
then please post back
I may help you.....
May 8 '07 #3
ok explain it


one favour ,

im jeeva im proficient in oracle developer
i like to do project in forms & reports or pl/sql
can u help me
plz give some topic
May 10 '07 #4
debasisdas
8,127 Expert 4TB
USING ANSI SQL --TO DISPLAY HIERARCHICAL DATA
=============================================
The START WITH...CONNECT BY clause.
The PRIOR operator.
The LEVEL pseudocolumn.

SYNTAX
------------------------
[[START WITH condition 1]CONNECT BY condition2]

START WITH condition 1
-----------------------
IT SPECIFIES THE ROOT OF THE HIERARCHY. ALL ROWS THAT SATISFIES CONDITION1 ARE CONSIDERED ROOT ROWS.IF START WITH CLAUSE IS NOT SPECIFIED ALL ROWS ARE CONSIDERED ROOT ROWS.CONDITION 1 CAN INCLUDE A SUB-QUERY.

CONNECT BY condition2
---------------------
SPECIFIES THE RELATIONSHIP BETWEEN PARENT ROWS AND CHILD ROWS.THE RELATIONSHIP IS EXPRESSED AS A COMPARISION EXPRESSION,WHERE COLUMNS FROM THE CURRENT ROWS ARE COMPARED TO CORRESPONDING PARENT COLUMNS.THE CONDITION2 MUST CONTAIN THE PRIOR OPERATOR WHICH IS USED TO IDENTIFY COLUMNS FROM THE PARENT ROWS.CONDITION2 CAN'T CONTAIN ANY SUB-QUERY.
SINCE THE CONNECT BY CONDITION SPECIFIES THE PARENT-CHILD RELATIONSHIP IT CAN'T CONTAIN A LOOP(IF A ROW IS BOTH DIRECT ANCESTOR AND DIRECT DECENDANT OF ANOTHER ROW THERE IS A LOOP).

PRIOR
------
PRIOR IS A BUILT-IN ORACLE SQL OPERATOR THAT IS USED WITH THE HIERARCHICAL QUERIES ONLY. IN A HIERARCHICAL QUERY THE CONNECT BY CLAUSE SPECIFIES THE RELATION BETWEEN PARENT AND CHILD ROWS.WHEN THE PRIOR OPERATOR IS USED IN AN EXPRESSION IN THE CONNECT BY CONDITION, THE EXPRESSION FOLLOWING THE PRIOR KEYWORD IS EVALUATED FOR THE PARENT ROW OF THE CURRENT ROW IN THE QUERY.
May 10 '07 #5
Thank u very much
May 10 '07 #6
debasisdas
8,127 Expert 4TB
Try these sample code.

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT ENAME,EMPNO,MGR FROM EMP START WITH MGR IS NULL CONNECT BY PRIOR EMPNO=MGR
  3. ------------
  4. SELECT ENAME,EMPNO,MGR FROM EMP START WITH MGR IS NULL CONNECT BY MGR=PRIOR EMPNO;
  5. ------------
  6. SELECT ENAME,EMPNO,MGR FROM EMP START WITH ENAME='JONES' CONNECT BY MGR=PRIOR EMPNO;
  7. -------------
  8. SELECT ENAME,EMPNO,MGR FROM EMP START WITH HIREDATE=(SELECT MIN(HIREDATE) FROM EMP) CONNECT BY MGR=PRIOR EMPNO;
  9.  
Hope these will help u a lot.
May 10 '07 #7
Thank u very much it is very useful to me
May 15 '07 #8

Post your reply

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

Similar topics

7 posts views Thread by Bernard Drolet | last post: by
3 posts views Thread by Mary Jane Pronio | last post: by
7 posts views Thread by Michi Henning | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.