Example 1(No warning):
Code:
------------------------------ Commands Entered ------------------------------
WITH r(k) AS (
VALUES 1
UNION ALL
SELECT k + 1
FROM r
WHERE k < 3
)
SELECT * FROM r
;
------------------------------------------------------------------------------
K
-----------
1
2
3
3 record(s) selected.
Example 2(Warning SQL0347W):
Code:
------------------------------ Commands Entered ------------------------------
WITH r(k) AS (
VALUES SMALLINT(1)
UNION ALL
SELECT k + 1
FROM r
WHERE k < 3
)
SELECT * FROM r
;
------------------------------------------------------------------------------
K
------
SQL0347W The recursive common table expression "DB2ADMIN.R" may contain an
infinite loop. SQLSTATE=01605
1
2
3
3 record(s) selected with 1 warning messages printed.
Example 3(Warning SQL0347W):
Code:
------------------------------ Commands Entered ------------------------------
WITH r(k) AS (
VALUES BIGINT(1)
UNION ALL
SELECT k + 1
FROM r
WHERE k < 3
)
SELECT * FROM r
;
------------------------------------------------------------------------------
K
--------------------
SQL0347W The recursive common table expression "DB2ADMIN.R" may contain an
infinite loop. SQLSTATE=01605
1
2
3
3 record(s) selected with 1 warning messages printed.