Hello,



we had an open cursor problem ourselves and got a few code examples from
MBS which may can cause this error.

I hope this could help you a little bit.



Brgds

Mario





--- snip

changing X++ code



I have some examples from another request. I think you have to reprogram
your code, so you don't produce all these cursors If you code:



While select a

{

select b where b.f = a.f

select c where c.f = b.f

while select d where d.f=c.f

...his to 1

...



you will generate a lot of cursors!!! In above example it uses 4 cursors
where a smart join can reduce this to 1 and thereby save a lot of server
trips!!



Below constructed code can also generate a lot of cursors because the
cursor reuse doesn't work in the loop :



for (ordrCnt = 1;ordrCnt <= TPCOrder.O_OL_CNT;ordrCnt++) {
TPCOrderLine.OL_I_ID = tI.getRandomItem(); select firstOnly I_Price,
I_Name, I_data from TPCItem // This cannot be reused!!!

where TPCItem.I_ID == TPCOrderLine.OL_I_ID; ..

..

..



}



If the loop is run through 10 times it uses 10 cursors for the internal
lookup!!!



Can be solved by:



for (ordrCnt = 1;ordrCnt <= TPCOrder.O_OL_CNT;ordrCnt++) {
TPCOrderLine.OL_I_ID = tI.getRandomItem(); select firstOnly I_Price,
I_Name, I_data from TPCItem // This cannot be reused!!!

where TPCItem.I_ID == TPCOrderLine.OL_I_ID;



..

..

..

myVariable = TPCItem.myField



// Force/Enable CursorReUse

TPCItem = NULL;



}



Or the more secure:



for (ordrCnt = 1;ordrCnt <= TPCOrder.O_OL_CNT;ordrCnt++) {
TPCOrderLine.OL_I_ID = tI.getRandomItem();



// Force/Enable CursorReUse for next loop TPCItem = NULL;



select firstOnly I_Price, I_Name, I_data from TPCItem // This cannot be
reused!!!

where TPCItem.I_ID == TPCOrderLine.OL_I_ID;



--- snip





________________________________

Von: [email protected]
[mailto:[EMAIL PROTECTED] Im Auftrag von affekatz
Gesendet: Mittwoch, 21. Dezember 2005 09:17
An: [email protected]
Betreff: [development-axapta] Open cursors



Hi

we got a problem with axapta the message we get is: Number of open
cursors excedes 90. We are aware of that it's possible to add more
cursors but we are more interested in correcting the error. The
problem is that it dosn't seems like axapta's debugger can catch these
errors.

Are there any guidelines to what code sutch open cursors errors will
be created by. ( Has it anything to do with ttsbegin / commit or maybe
queries ??)


Thomas










________________________________

YAHOO! GROUPS LINKS



*      Visit your group "development-axapta
<http://groups.yahoo.com/group/development-axapta> " on the web.
       
*      To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
be>
       
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



________________________________



[Non-text portions of this message have been removed]





SPONSORED LINKS
Computer part Programming languages Microsoft axapta
Support exchange


YAHOO! GROUPS LINKS




Reply via email to