473,414 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

preventing CONNECT BY from generating an error if cycles exist

Hello;

I am wondering if anyone knows of a way to issue the CONNECT BY
clause on data that contains cycles? I have a business requirement
that specifies that cycles could be present in the data and cannot be
prevented. I want to use the CONNECT BY clause to prevent sending
massive IN clauses, but I cannot because CONNECT BY will generate an
error. Is there a similar clause that I can use besides CONNECT BY?

Any help would be appreciated.

Sincerely,

pa**@paulrowe.com
Jul 19 '05 #1
1 3805
The problem is CONNECT BY is designed for tree walking tree data
structures, whereas the scenerio you describe is not a tree as it has
no finite path when traversed. Without Oracle's treewalk cycle checks
it wouldn't know when to stop, it could get caught in an infinite
loop.

I haven't tried this, but if you knew the id of the item which causes
the cycle on a given treewalk, you could do something like this :

select id, lpad(' ', 6*(level-1))||name
from mytable
start with parent_id is null
connect by parent_id = prior id and
id <> :StartOfCycleID

but you could have many IDs which cycle for a given treewalk
especially if you walk from root to leaf, and remember you can't use
sub queries or joins in treewalks to join to many StartOfCycleIDs.

Perhaps a StartOfCycleID could be determined from a PL/SQL function
which keeps track of the last id when doing a for rec loop, until the
cycle exception occurs?

It's a tough one!

Paul Scott

On 1 Aug 2003 08:44:11 -0700, pa**@paulrowe.com (Paul Rowe) wrote:
Hello;

I am wondering if anyone knows of a way to issue the CONNECT BY
clause on data that contains cycles? I have a business requirement
that specifies that cycles could be present in the data and cannot be
prevented. I want to use the CONNECT BY clause to prevent sending
massive IN clauses, but I cannot because CONNECT BY will generate an
error. Is there a similar clause that I can use besides CONNECT BY?

Any help would be appreciated.

Sincerely,

pa**@paulrowe.com


Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Savas Ates | last post by:
in asp page im getting this error how can i solve it.. yesterday the codes work but i setup visual studio 6.0 now it doesnt works..
2
by: bk | last post by:
This is driving me crazy. I get "SQL Server is unavailable or does not exist" error while developing asp.net application in vs2003's IDE development mode but when I install the application on the...
10
by: et | last post by:
I have an asp.net program that uses a connection string, using integrated security to connect to a sql database. It runs fine on one server, but the other server gives me the error that "Login...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
0
by: Larry Rebich | last post by:
I am trying to use the sample web template that is distributed with Visual Studio 2005 called 'Personal Web Site Starter Kit'. After running for awhile it fails with the following message: ...
14
by: Dave Rahardja | last post by:
Hi all, Is it possible to prevent _at compile or link time_ the mulitple instantiation of a templated function? In other words, if there exists a function template <typename Tvoid fn(); I...
3
by: LamSoft | last post by:
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server... Some of the Code.. protected void LoginButton_Click(object sender, EventArgs e) { if...
1
by: umamaheswarig | last post by:
Hi all, Am getting the following error. when extracting the data from sql server. --------------------------------------------------------------------------------------------------------...
1
by: Paul Rowe | last post by:
Hello; I am wondering if anyone knows of a way to issue the CONNECT BY clause on data that contains cycles? I have a business requirement that specifies that cycles could be present in the data...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.