Solved

SQL400 max size

Posted on 2016-09-28
5
126 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
[X]
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
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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 will show, step by step, how to integrate R code into a R Sweave document
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

687 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