Problem solve Get help with specific problems with your technologies, process and projects.

Sizing up querys of DB2 for z/OS

I have a dynamically generated query which uses an 'in' statement with lots of options. When I run the query it gives me a 'statement too long or too complex' error. Is there any method to increase the maximum size of the query?
Well, if you are using DB2 for z/OS, the good news is that Version 8 will support larger SQL statements - up to 2,097,152 bytes long. The limit for V7 and earlier versions of DB2 for z/OS is 32,765 bytes. This is a significant gain in SQL statement size and perhaps your complex query with the large IN-list might work in Version 8. The bad news, of course, is that you will have to move to the latest version of DB2 to obtain this support.

If you cannot move to Version 8, or if you are already there and have this problem, then your only option is to break the SQL statement apart into several smaller - and less complex - SQL statements.

Dig Deeper on IBM DB2 management

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.