Connect by Level

General

Connect by Level

Hi Guys,

I have been migrating from Oracle to Teradata and would like your help to convert the following Oracle SQL code to Teradata SQL

SELECT LEVEL AS COUNT1 FROM dual CONNECT BY level <= 10;

Any help would be appreciated!!

Tags (1)
2 REPLIES
Junior Contributor

Re: Connect by Level

Hi Nihal,

this query simply returns a list of integers between 1 and 10, you can easily get the same result with:

select day_of_calendar as count1 
from sys_calendar.calendar
where day_of_calendar between 1 and 10;

More complex queries implemented with CONNECT BY can be rewritten using Standard SQL's WITH RECURSIVE syntax.

Re: Connect by Level

Thank you Dieter...you just saved me a lot of time!!!