Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL400 max size

Posted on 2016-09-28
5
99 Views
Last Modified: 2016-09-30
Hi Experts,

While running SQL commands in some own (customer tool) SQLRPGLE, I have the problem that a execute immediate command, exceeds the length of 32700.
If I extend this variable, I get a precompiler error.

Is 32700 de maximum length for a prepared SQL command ?
0
Comment
Question by:theo kouwenhoven
5 Comments
 
LVL 14

Accepted Solution

by:
daveslater earned 500 total points
ID: 41821356
Yes 32000 is the max length.
I would like to know what the heck it is doing!!!
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 41821378
It contains a Create procedure commanr (more or less nice formatterd),
by removing all extra spaces and [CR][LF] commands, I'm now back to 30450, but it will give problems by next extention of the function :-S

Thanks for the confirmation Dave.
0
 
LVL 27

Expert Comment

by:tliotta
ID: 41821558
SQLRPGLE members can compile with SQL statement sizes up to 32766 bytes. Not sure why that specific number is the limit.
0
 
LVL 29

Expert Comment

by:pepr
ID: 41822584
To clarify the number, the 32766 is probably related to the implementation of the string that (wild guess) or may use the 32 KB blocks for single byte characters or it uses a 64 KB block for two bytes per character. The 64 KB is 2^16 which is 2 * 2^15 (that is 2 * 32767). But the implementation of the string may need 2 bytes to store the length of the string. This way, it is likely that 64 KB block of two bytes per char string is used. Otherwise, the maximum length of the string would be 32765 (if I am not mistaken). ;)
0
 
LVL 35

Expert Comment

by:Gary Patterson
ID: 41824372
Carryover from the old 32K character data type limit in RPG.  SQL precompiler is separate from RPG compiler, and isn't always updated when RPG is.

pepr is right:

Various char types were implemented in RPG in the past with a 32K/32,768 byte overall limit (an even 8 pages of memory).  So fixed length character had a 32768 byte limit, and variable length character data type was implemented as a 2 byte integer at the front for the length, plus a 32766 character area, hence the occasional 32766 length limitation.

Varchar and char in current ILE RPG have a 16MB (-4 bytes for varchar to hold the length) limit.
 
IBM i DB2 SQL at V7R2 supports SQL statements up to 2,097,152 bytes.  

Can you use a different interface, like Run SQL Scripts in Navigator, or RUNSQLSTM?

Another alternative is to break the proc into two or more procedures at a convenient point and call one from the other.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question