on 2013 Oct 07 11:15 AM
An error occurred when reading the results of the SQL statement
Shows the results may be incorrect or incomplete
Too many recursive iteration times
SQLCODE=-923,ODBC 3 status="HY000"
with recursive ps(product_code,description,parent_id) as (select product_code,description,parent_id from product_code where parent_id='cp' union all select b.product_code,b.product_code,ps.parent_id from ps,product_code b where ps.parent_id=b.product_code) select * from ps
Request clarification before answering.
See: SQLCODE -923 "Too many recursive iterations". You have exceeded the maximum recursion level of the server, set by max_recursive_iterations.
You have numerous errors in your recursive SQL query:
b.parent_id = ps.product_code
parent_id = 'cp'
- while you can certainly do this, I would suspect you are really trying to use where product_code = 'cp'
.Here is the SQL:
with recursive ps(product_code,description,parent_id) as (select product_code,description,parent_id from product_code where product_code='cp' union all select b.product_code,b.description,b.parent_id from ps,product_code b where ps.product_code=b.parent_id) select * from ps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To add to Jeff's explanation:
Furthermore it might not be clear that the recursive query (i.e. the "select b.product_code, ... where ps.product_code=b.parent_id") has a limitation itself - the error given usually does come up when the recursion enters a loop, that is when the same rows will be added again and again...
IMHO, that will happen here as there is no WHERE clause that prevents another joined row from ps x b to be added recursively to ps...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.