Diff between connect by prior empno = mgr  & connect by empno =   prior mgr

Hi ,
Can any body tell me why both query give different result please tell me why
select empno, mgr,ename, level
from scott.emp
start with ename = 'JONES'
connect by prior empno = mgr
select empno, mgr,ename, level
from scott.emp
start with ename = 'JONES'
connect by empno = prior mgr

Hi,
nav wrote:
Hi ,
Can any body tell me why both query give different result please tell me whyWhy would you expect them to be the same?
PRIOR empno = mgris different from
empno = PRIOR mgrin the same way that
SQRT (x) = ymeans something other than
x = SQRT (y)
select empno, mgr,ename, level
from scott.emp
start with ename = 'JONES'
connect by prior empno = mgr This is what's called a Top-Down Query , where you find 'JONES' and all its descendants (as you normaly look at the hierachy).
On each level (>1), a new row will join the result set if its mgr is the same as the empno of a row on the prior level.
For example: the START WITH clause says that 'JONES' (empid=7566) will be on LEVEL=1.
Who will be on LEVEL=2? Any row that satisfies the CONNECT BY condiition "PRIOR empno = mgr". Since 7566 is the only empno on LEVEL=1, that is equivalent to saying "7566 = mgr". There happen to be 2 rows that meet that condition: ename='SCOTT' (empno=7788) and ename='FORD' (empno=7902).
Who will be on LEVEL=2? Any row that satisfies the CONNECT BY condiition "PRIOR empno = mgr". Since the rows with empnos 7788 and 7902 are the only rows on LEVEL=1 in this case, the condition is equivalent to saying "7788 = mgr OR 7902 = mgr". There happen to be 2 rows that meet that condition: ename='ADAMS' (empno=7876) and ename='SMITH' (empno=7369).
Who will be on LEVEL=3? Any row that satisfies the CONNECT BY condiition "PRIOR empno = mgr", which, in this case, is equivalent to saying "7876 = mgr OR 7369 = mgr". There happen to be no rows whcih meet that condition.
select empno, mgr,ename, level
from scott.emp
start with ename = 'JONES'
connect by empno = prior mgrThis is called a Bottom-Up Query , where you find 'JONES' and all its ancestors (as you normaly look at the hierachy).
On each level, a new row will join the result set if its empno is the same as the mgr of a row on the prior level.
Edited by: Frank Kulash on Apr 28, 2011 1:38 PM

Similar Messages

  • Difference between connection, session and process

    Hi all,
    Can anyone please update me on the difference between connection,session and process.
    Thanks in advance,
    - Sri

    I got this useful note by googled in net. It describes session,connection,process gracefully.
    A connection is a physical circuit between you and the database.A connection
    might be one of many types -- most popular begin DEDICATED server and SHARED
    server. Zero, one or more sessions may be established over a given connection
    to the database as show above with sqlplus. A process will be used by a session
    to execute statements. Sometimes there is a one to one relationship between
    CONNECTION->SESSION->PROCESS (eg: a normal dedicated server connection).
    Sometimes there is a one to many from connection to sessions (eg: like
    autotrace, one connection, two sessions, one process). A process does not have
    to be dedicated to a specific connection or session however, for example when
    using shared server (MTS), your SESSION will grab a process from a pool of
    processes in order to execute a statement. When the call is over, that process
    is released back to the pool of processes.

  • Difference between connection pooling and simple connection

    Anybody please tell me what is the Difference between connection pooling and simple connection and also where we define connection pooling and how.
    Thanks
    Please reply soon
    amitindia

    Creating and closing connection to the database is a relatively slow process. Equally connections use database resources so you can't just open as many as you want.
    A connection pool maintains a number of open connections throughout the lifetime of the application. Instead of opening and closing the connections your application just "borrows" them from the pool when they're needed.
    If the pool runs out of connections it will usually create new ones as needed until you reach some predefined upper limit.
    A good connection pool will also manage connections which have failed for any reason, and report code which fails to return connections to the pool (ie connection leaks).
    The number of connections created at startup is referred to as the "low water mark" and the maximum number that the pool will allow to be opened at any given time is the "high water mark". If no connections are available client code will generally block until one is released.
    If by "defined" you mean where can you get a working implementation then your database or application server vendor is likely to provide one. Also the Apache Jakarta Commons includes [url http://jakarta.apache.org/commons/dbcp/]an implementation which you can use with any JDBC driver.
    Dave.

  • I use BT Yahoo! but when I try and navigate to email from the home page it keeps jumping between 'connected and waiting for login' and never loads up.

    My internet service provider is BT in the UK. The home page is www.btinternet.com. After I've logged on, the home page displays fine - I can see the summary of my emails in one of the windows on the home page. The problem comes when I click on the mail application. The page then tries to load the email application. However, it never actually loads, it keeps jumping between connected and waiting for login. It never achieves it so I just have to click the 'back' button to get to the home page. I use chrome and ie but neither has this problem.

    I retraced my steps to how i got the Google app:
    App Store icon on Home Screen > Search, at bottom > entered Google
    The first Google App on the screen appears:
    Google logo small g in blue square: Google Search; Open (because it is already installed).  Below that is a picture of the iPod with the usual  Google Search screen.  I have never inserted a link into a discussion group so i hope you can open this. 
    http://https://itunes.apple.com/us/app/google-search/id284815942?mt=8
    Does this bring us any closer? 

  • Connection between Connection Object & Contract Account

    Hi ISU GURU's
    Could any one pls let me know where exactly connetion object is linked to contract account.
    Basically our problem is where exactly we can maintain connection between technical master data to business master data.
    Thanks in advance
    sree

    Hi Owk,
    Well, I love to explain the things with the example, i don't know would you follow the same approach... Never the less, first with the example and then bit technical:
    E.g.
    I have a building:
    4290, El camino real Palo Alto - 94301, CA
    It contains number of Aprtments : 3
    Every aprtments have : 1 individual Electric connection
    Payment = Individually
    So there are 2 questions raised,
    >> what physical entities are mapped to what technical objects in IS-U master data??
    >> Where are the link between customer data and technical things ??
    Ans 1:
    1 Building = Connection Object
    3 Apartments = 3 premise
    3 customers = 3 contract accounts
    3 Individual payments/Connections = 3 contracts & 3 installations
    Ans 2:
    There si no direct linkage between connection objec and contracty account as both are sperate entities but
    : Customer - > contract account
    : Connection object -> Premise
    >>>>>>>>>>>>At the time of Move-in (EC52E), the Business master data (Customer -> contract account) is got linked to the Technical master data (Installation - > Devices -> Device Location - >Premise -> COnnection Object).
    Customer - > Contract account
                           Contract (Contract gets cretaed at the time of move-in so as link)
                           Installation - Premise - Connection Object
                           Device Location
                           Devices and registers
    Don't hesitate to ask again, if it doesn't solve the problem
    Cheers,
    Amit

  • Difference Between connect and connector steps

    Hi All,
    What is the difference between connect step and connector step in a workflow?
    Thanks
    Narendra

    Hi Narendra,
    Connect: Connects the two steps. These two steps are on the same page of MS visio.
    Connector: Connects the two steps of WF if these two steps are on different pages of MS visio, as in case of a huge WF design you can use multiple pages of visio. This is why we have only one point of connection at this icon. It automatically connects the step connected to it to the first step on the next page.
    Hope this is clear.
    Regards,
    Dheeraj.
    Edited by: Dheeraj Kumar on Jul 11, 2008 11:39 AM

  • Difference Between Connect,Create Session

    Hi,
    What is the difference between connect , create session ?
    Regards,

    But i grant the user connect but when i try to logon by the user i got error you don't have right to create session?I don't know what you have.
    I don't know what you do.
    I don't know what you see.
    It is really, Really, REALLY difficult to fix a problem that can not be seen.
    use COPY & PASTE so we can see what you do & how Oracle responds.
    Oracle is too dumb to lie about what is wrong.

  • What is the difference between connecting to oracle thro LDAP and thro TNS

    what is the diff bet connecting to oracle through TNS,Direct and LDAP authentication

    Dear User,
    TNS -
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14212/glossary.htm#sthref2007
    Direct -
    Without TNS entry.
    LDAP
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14268/asowalet.htm#CHDFHBJG
    Regards,
    Taj

  • What is the difference between connecting a printer via USB or Ethernet ?

    What is the difference between connecting a printer via USB or Ethernet ?

    When a Printer with an Ethernet connector is connected via Ethernet, it becomes a peer device on your Network. It is available whenever it is on for all users on your Network.
    When connected via USB, it relies on your computer to "Share" it onto the local Network. It is only available when the attached computer is on. It takes resources from that computer to facilitate printing for any User.

  • How can I make a server differ between two or more clients?

    How can I make a server differ between two or more clients?
    The clients can connect and talk to the server fine, but how can I make the server talk to one, two or all clients? i.e. what would be a good way to implement this?
    Currently, the server listens for connections like this:
    while (listening) {
    try {
    new ServerThread(this, serverSocket.accept()).start();
    I guess one way would be to add the ServerThreads to a Hashtable with the client ID as key, and then get the ServerThread with the proper client ID, but this seems unnecessary complicated. Any ideas?

    Complicated was perhaps the wrong word, I should have
    written something like it doesn't "feel" right. Or is
    this a common and good way to solve communication
    between a server and multiple clients?Thats pretty much how I do it. I normally use an array or ArrayList of Sockets instead of HashTable, with [0] being the first player etc.... Then you can communicate with exactly who you want. If you want to send bytes to all of them, just send the same thing to each socket individually (or is there a better way to do this?).

  • Diff between SOAP & HTTP Adapters

    Hi
       sap xi consultant
           I need some information about diff between SOAP & HTTP adapters which one is better then why mostly using adapters(soap/http) pls expailn this.
    Thanks&Regards
    rajashekar

    we use SOAP adapter when we need to connect to remote system or use Webservices in these cases we use SOAP adapter.
    HTTP Adapter is used by extenal systems to connect to Intergartin server using native HTTP Interface.
    the http adapter is a service which is directly connected to integration engine. Adapter Framework (Java) isnt involved. It is much more performant than SOAP adapter.
    Refer the below thread which has more information:
    Difference between HTTP And SOAP Adapters.
    Differences between HTTP and SOAP adapters?
    Thnx
    Chirag

  • Diff between 4.7e and ecc 6.0

    hi abapers !
    can any tell me the diff, between 4.7e and ecc 6.0 ?
    cheers.
    rajesh.

    Hi.
    First of all I would like to ask you to have a look into our rules of engagement. One of the really important rules for our forums is that you should try to solve your question yourself first. One very usefull tool are search engines. Perhaps you heard about google or some other internet search. And there is a search function in the SDN too. Please use it before asking any question.
    Then I would like to ask you to give as much information as available regarding your question. My first intention was to answer 1.3. As Eric did that before me I refrain from this. But please understand: No one here in the forums knows in which kind of diff are you interested. And don't tell me you want to know all differences. I have seen such questions but then the only correct answer would be a source code diff. And that would be a little bit more than we allow for postings.
    And then: This is an ABAP forum. If you are asking which changes have been done to the programming language ABAP between this versions then you are in the right forum. If not -> ask somewhere else.
    Future postings as unspecific as this one might get locked or deleted without prior notice.
    Best regards,
    Jan Stallkamp

  • Diff between  filter , RKF,Condition

    Hi experts,
    I have doubt abt the diff between  filter , RKF,Condition.
    I know the definitions. when executing the reports. how it exactly doing in backend.
        like is there any SQL query is executing behind to display the results.

    Hi Venkatdas,
    From the SQL perspective:
    Filter criteria you specified in the "Filter" directly goes in WHERE clause.
    e.g. If you have sales order data, if you only want to display sales org 1000 data.
    SELECT * FROM ORDERS
    WHERE sales_org = '1000'
    In case of "FILTERS" you can only apply criteria on "Characteristic", you can't apply criteria on keyfigure value.
    Where as in case of "_Restricted Key Figure_", instead of limiting the entire data set you will be limiting a keyfigure based on a characteristic value.
    e.g. If the requirement is to show the data by division by current year vs. prior year comparison in columns.
    Current Year Prior year
    Division
    10 $104,000.00 $8,320.00
    20 $138,666.67 $124,800.00
    30 $242,666.67 $169,866.67
    SELECT  DIVISION, SUM( DECODE(YEAR, 2010, SALES$s, 0) ) , SUM( DECODE(YEAR,2009, SALES$s, 0) )
    FROM ORDERS
    GROUP BY DIVISION.
    As you can see incase of "Restricted Keyfigure" entire data set is not restricted; instead a value of the output is restricted based on a characteristic value.
    Condition, no data is limited at database level. From the SQL perspective there would not be any data restrictions. Once the data comes to OLAP layer, you would apply a condition to only show data meets a criteria.
    e.g. Display only top 10 materials.
    SELECT MATERIAL SUM( SALES$s)
    FROM ORDERS
    WHERE YEAR = 2010
    GROUP BY MATERIAL.
    The above statement would output all the material and the corresponding sales in year 2010. Once these rows comes to OLAP layer, CONDITION will kick-in and sort the data by SALES$s and only display to 10 materials.
    Cheers,
    Thanks
    Vasu Sattenapalli

  • What are the Major and Minor Diffs between oracle,sql server,MSAccess

    Hi all,
    Can any one explain or send me all the diff between
    oracle ,sql server,access..like how much data can each
    support,...
    Thanks

    Dear sir,
    here it is.
    http://www.oracle.com/database/product_editions.html

  • In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    hello all
    In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    Hi Swamy,
    The differences between IDoc and BAPI are as follows: 
    IDOC
    IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system.
    Idocs are processed asynchronously and no information whatsoever is returned to the client.
    The target system need not be always online. The IDOC would be created and would send the IDOC once the target system is available (tRFC concept). Hence supports guaranteed delivery.
    With asynchronous links the sub-process on the client can be finished even if the communication line or the server is not available. In this case the message is stored in the database and the communication can be done later.
    The disadvantage of asynchronous links is that the sub-process on the server cannot return information to the calling sub-process on the client. A special way for sending information back to the client is required. In addition, a special error handling mechanism is required to handle errors on the receiving side.
    IDOCs may be more changeable from release to release.
    IDOCs  are poorly documented.
    BAPI
    BAPIs are a subset of the RFC-enabled function modules, especially designed as Application Programming Interface (API) to the SAP business object, or in other words: are function modules officially released by SAP to be called from external programs.
    BAPIs are called synchronously and (usually) return information.
    For BAPIs the client code needs to do the appropriate error handling.
    Problems with synchronous links occur if the communication line or the server is temporarily not available. If this happens, the sub-process on the client cannot be finished (otherwise there would be data inconsistencies).
    Synchronous links have the advantage that the sub-process on the server can return values to the sub-process on the client that has started the link.
    BAPIs are not totally immune to upgrades.
    BAPIs are reasonably well documented.
    Reward points if useful.
    Best Regards,
    Sekhar

Maybe you are looking for

  • I experience strange vertical lines over the text

    I experience strange vertical lines over the text. i belive it started when i updated my firefox to it's latest version i tried synchronizing me clear view, but it didn't help

  • Aperture is taking forever to Rebuild my Database

    Hi, It seems my Aperture Library has corrupted. This happened after i updated to the latest version of Aperture 3.4.1. I'm running my libary file on an external FW800 WD1.5 TB drive. the library is about 400GB.  Haven't been able to open the file for

  • Cropping tool now deletes whole image in Photoshop CS4

    Recently the cropping tool has taken to deleting the whole image, no matter what is cropped.  I've been attempting to trim the edges, something that was working just fine a few months ago (now operating under Snow Leopard, so wouldn't be awfully surp

  • Need help can not use my Photoshop Elements

    Hi I bought the Samung Series7 Ultra "CORE i5" from Bestbuy. but every time I try to open photoshop so I can not. Why ? Error 213:19

  • IMac won't boot up after latest update

    Hi I'm a newbie to this forum but any help would be greatly appreciated please We've had our iMac for 2yrs now no issues but when I went to do the latest update today it's gone a bit weird! I did the install and relaunch like I always do but when reb