473,473 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Supress SQL0347 (CTE may contain infite loop)

Hello,

we have a perfectly working recursive CTE which gives us SLQ0347 (The
recursive common table expression "<name>" may contain an infinite
loop.)

The CTE parses a string ("This,is,a,string"), removes word by word and
runs while length(col) 0. DB2 doesn't detect this as a terminating
condition and therefore issues the warning. Does someone have a nice
solution to work around this?

Or better yet, does someone have a function
comma_separated_string_to_table()? Something like

$ db2 "select * from table(csstt('This,is,a,string')) as a"
1
---------------
This
is
a
string

4 row(s) selected.
$
Oct 20 '08 #1
1 3221
w.*********@googlemail.com wrote:
Hello,

we have a perfectly working recursive CTE which gives us SLQ0347 (The
recursive common table expression "<name>" may contain an infinite
loop.)

The CTE parses a string ("This,is,a,string"), removes word by word and
runs while length(col) 0. DB2 doesn't detect this as a terminating
condition and therefore issues the warning. Does someone have a nice
solution to work around this?
Just add a little counter:
WITH rec(...., level) AS (VALUES (..... 1) UNION ALL (SELECT ... level +
1 FROM ,,, WHERE level < 10000000) ...

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Oct 20 '08 #2

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

Similar topics

1
by: David | last post by:
I have a custom control that contains a class that Inherits the panel control. I am trying to catch a keydown event in this class and then supress it from the rest of the control as well as the...
4
by: Mike | last post by:
Hello, I'm trying to use a recursive CTE to find some data but I am having trouble crafting the CTE; maybe what I want isn't possible. I have the following tables: EMPLOYEE (int ID, int...
0
by: champ1979 | last post by:
I wrote an algorithm to get all the relatives of a person in a family tree. I'm basically getting all the users from the DB and am doing the recursive logic in code, so that there is only 1 call...
0
by: emccormick | last post by:
Hi, Using BIDS / Report Designer with SSRS / SQL2005(SP2) and for one dataset, I'm trying to make a CTE into a 'dynamic' query by wrapping the accessor query in an Iif() function. Here it is: ...
0
by: steve | last post by:
Sql really has two standards. There is the ANSI sql standard and then there is the DOUBLE standard. The rest @ http://beyondsql.blogspot.com/2007/10/sql-two-standards-of-sql-cte.html
0
by: Archana Patil | last post by:
I have following data -------------------------------------------------------------------------------------------------------------- PNode Table...
4
by: the6campbells | last post by:
for the conext of this example imagine a simple part table where a part can only have a single parent. try to express a cte where the result set must be balanced. That is, the result set repeats...
5
by: Serge Rielau | last post by:
Lennart wrote: We added CROSS JOIN as a synonym for INNER JOIN ON 1=1 in DB2 9.5. There are a pile of such "syntactic sugar" featurettes in DB2 9.5. Cheers Serge -- Serge Rielau DB2...
3
by: sandeep.iitk | last post by:
I am using a query into db2advis for index recommendation. this query is having a CTE (with clause). when I run db2advis it returned some error like Database is reporting the following error:...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.