Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:40:48+00:00 2026-05-30T22:40:48+00:00

Oracle ships with a very handy feature. You can create hierarchical queries (recursive behaviour)

  • 0

Oracle ships with a very handy feature. You can create hierarchical queries (recursive behaviour) using the following clause:

CONNECT BY [NOCYCLE] {condition [AND condition...]} [START WITH condition]

As documented here:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/queries003.htm

I’m wondering, are there any other established RDBMS that support an equivalent or similar syntax? Or can recursive behaviour like this be generically simulated using regular SQL?

A good example that I’d like to be able to simulate is this (taken from the Oracle documentation):

    SELECT LPAD(' ', 2 * (LEVEL-1)) || last_name org_chart, 
           employee_id, manager_id, job_id
      FROM employees
START WITH job_id = 'AD_VP' 
CONNECT BY PRIOR employee_id = manager_id; 

Resulting in:

ORG_CHART          EMPLOYEE_ID MANAGER_ID JOB_ID
------------------ ----------- ---------- ----------
Kochhar                    101        100 AD_VP
  Greenberg                108        101 FI_MGR
    Faviet                 109        108 FI_ACCOUNT
    Chen                   110        108 FI_ACCOUNT
    Sciarra                111        108 FI_ACCOUNT
    Urman                  112        108 FI_ACCOUNT
    Popp                   113        108 FI_ACCOUNT
  Whalen                   200        101 AD_ASST
  Mavris                   203        101 HR_REP
  Baer                     204        101 PR_REP
  Higgins                  205        101 AC_MGR
    Gietz                  206        205 AC_ACCOUNT
De Haan                    102        100 AD_VP
  Hunold                   103        102 IT_PROG
    Ernst                  104        103 IT_PROG
    Austin                 105        103 IT_PROG
    Pataballa              106        103 IT_PROG
    Lorentz                107        103 IT_PROG

The LEVEL pseudo column and the indentation achieved with it is not so important to me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:40:49+00:00Added an answer on May 30, 2026 at 10:40 pm

    There is an article on the developerworks site Port CONNECT BY to DB2 that does a nice conversion.
    Also an interesting article on Explain Extended (Quassnoi’s blog) that shows some difference between CONNECT BY and recursive CTE: Adjacency list vs. nested sets: Oracle, being row-based and set-based. He has also a nice article about “SQL Server: are the recursive CTE’s really set-based?”. It seems that the “recursive CTE in Oracle is also not set based”. I hope this helps with the conversion, recursion in JOOQ and understanding the difference of both implementations of recursion in SQL.

    Regards,
    JJ.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Oracle SQL can do hierarchical queries since v2, using their proprietary CONNECT BY syntax.
I am trying to connect to an Oracle Database using nHibernate. I can connect
In Oracle, I can use the following: String query = { ? = call
In Oracle, we do this: def TNAME=&1 create table &TNAME (foo varchar(10)); How to
Reference:Oracle documentation Oracle Database enforces all PRIMARY KEY constraints using indexes Q's 1> I
In Oracle's PL-SQL, you can declare a variable and define its type based on
Oracle knows the limitation to 1000 elements in the where a in (..) clause.
Oracle describes the Easy Connect string as username@[//]host[:port][/service_name][:server][/instance_name] (from http://www.oracle.com/technology/products/oraclenet/files/OracleNetServices_NetEasyConnect.pdf ) However, some of
Oracle doesn't support the TIME datatype, but you can use DATE to store a
Oracle has 2 functions - rank() and dense_rank() - which i've found very useful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.