Re: 4GL err -257: System limit on maximum number of statements exceeded
Posted in 1996
There is a performance benefeit by having a statement prepared only once and reused. Beside that cursors and statements must be uniquely declared within one program module. So you could have reused id's in different modules. Mariusz Malogrosz Performance Analyst TECSYS Inc. Andrej Falout <afalout@zg.tel.hr> wrote in article <32b690c9.2312852@news.tel.hr>... > Hi, > > I am trying to keep compatibility with V 5.0 OnLine server in 4GL app, > by keeping the limit on prepare & declare stmts., but reducing number > of declare stmts. alone did not helped. If I'm not missing something, > it should (?) > > Finderr: > > -257 > > System limit on maximum number of statements exceeded, maximum is > count. > > The database server can handle only a fixed number of prepared SQL > statements for each user. Included in this limit are statements > prepared with the PREPARE statement and cursors declared with DECLARE. > This statement (a PREPARE, DECLARE, or PREPARE IMMEDIATE) exceeds that > limit. The statement is not executed. The FREE statement releases > prepared statements. Review the logic of your program and change it so > that it frees prepared statements when they are no longer needed. > Note: This restriction is removed starting with database servers at > software level 5.0; however, programs that might have to be compatible > with earlier versions should still use FREE to stay under the limit. > > This message is not used by database servers later than Version 5.01. > > but, > I writhed a test program with 70 times (my limit is 64) of: > > declare a1 scroll cursor for x1 open a1 fetch first a1 into p_test.* > ....... > declare a70 scroll cursor for x1 open a70 fetch first a70 into > p_test.* > > and only one prepare (of x1) at the beginning, and it did NOT reported > any errors. So, declare does not count ? > > I MUST reduce only prepare stmts.? > > Can I simply re-use names (stmt ID) I give in prepare for different > SQL statements, without using FREE ? I want to avoid using FREE. > > Andrej > >