CTE in Oracle

  • Hi,

    I have some data in a source system that is a PERFECT fit for a recursive CTE but unfortunately the data is in oracle.

     

    Does anyone know if Oracle has some similar abilities to a CTE?

     

    Thanks in advance

    -Jamie

    P.S. I believe I could set this up as a linked server and execute a CTE against it (is that correct???) but I'd rather not do that!

     

  • If this is a hierarchy, see oracle's proprietary "connect by".

    SQL = Scarcely Qualifies as a Language

  • Sorry, I should have been clearer in my original post. It is indeed a hierarchy in a self-referencing table.

    If CONNECT BY will do the job then that's great news. Thanks Carl!

     

    -Jamie

     

  • Hello Jamie,

    With Oracle you have a lot of flexibility in doing hierarchical queries.

    Not only CONNECT BY but also many other analytic functions:

    RANK, DENSE_RANK, LEAD, LAG, ... to use with OVER (PARTITION BY ...)

    Look in the Oracle doc.

    Regards,

    Carl

  • Thanks Carl. I'm using CONNECT BY and its working a treat. I'm quite impressed actually. Same functionality as a CTE yet alot less wordy.

    And before anyone castigates me...yes I know CTEs do alot more besides

    -Jamie

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply