我也遇到同样的问题。在批量执行sql的时候Informix说我的语句超过了最大长度。我的到了错误代码-79864。
Informix提供的FIND ERROR工具对这个错误代码给出了如下解释:
-79864__________________________________________________________ Statement length exceeds the maximum. Your application issued an SQL PREPARE, DECLARE, or EXECUTE IMMEDIATE statement that is longer than the database server can handle. The limit differs with different implementations but in most cases is up to 32,000 characters.Review the program logic to ensure that an error has not caused your application to present a string that is longer than intended. If the text has the intended length, revise the application to present fewer statements at a time.This error is the same as error -460 that the database server returns.看来需要把超常的sql语句拆分后分组执行。
我写了验证长度的一个方法,把要批量执行的sql语句拆分成多个组,再依次执行。
这样做只能解决批量执行的问题,仍然不能解决过长的sql。
如果sql真的很长,我认为需要从逻辑上拆分成几个单元。顺序执行。
再不然,就要考虑存储过程了。