I think that this has been raised before in this forum but didn't receive much response, so I'll start a new thread...
Whenever I use recursive SQL in a cursor declaration within a stored procedure, there is a danger that the SP will intermittently throw out an abnormal termination error (sqlstate 38503). This is irrespective of whether the SP is called from an external application or directly via the command line or SP builder.
I have trawled the web, and have found several references to this problem but no solutions. Generally people seem to think that this must be due to some sort of programming error but I am sure that this is not the case.
Although, the error is intermittent and fairly infrequent, it would seem that it is more prolific immediately after an SP has been compiled.