Solved

SQL400 max size

Posted on 2016-09-28
5
54 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 28

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 34

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now