MilindV
9th December 2008, 11:14
Hi All
I have a query.
I got fatal error(“ERROR : SQLState HY010: Function sequence error - fetch call out of sequence”) while executing the following code.

function Get.next.condition()
{
Select table.*
From table
Where table… = ….
Selectdo
………..
………..
………..
Get.next.condition()
………..
………..
………..
endselect
}


but fatal error does not stop the process.
Process execution continues normaly.

For time being i suppressed this error by setting error.bypass = 1

Is there any better solution?

Thanks
MilindV

george7a
9th December 2008, 11:21
Hi,

Check the following thread:
http://www.baanboard.com/baanboard/showthread.php?t=22850&highlight=recursion

I hope it helps,

- George

MilindV
10th December 2008, 05:50
Hi George

Thanks,
I went through the links. Didnt found much helpful:confused:.

Finally i removed the recursion and put that function in an
infinite loop to call it again and again.
and Breaking the loop on certain condition.

function infinite.loop()
{
while true
get.next.condition()
if loop then
break
endif
endwhile
}

function get.next.condition()
{
Select table.*
From table
Where table… = ….
Selectdo
………..
………..
………..
|* Get.next.condition() earlier
|* Now instead of calling function again i am returning back,
|* but as loop is infinite, control will come back to this function.
|* on particular condition i set the global variable loop to true so as break the loop
return
………..
………..
………..
endselect
}


I know this not a good solution but It is working.

I have not explained the solution in greater detail
as I myself didnt find it that great. I myself looking for better solution.
Still if any one interested can get back to me.

Thanks All
MilindV

mark_h
10th December 2008, 18:28
As far as I see nothing wrong with this solution. It reminds me of how Infor explodes BOM's - the only difference is they track the levels.

ben.kansas
22nd July 2009, 21:34
As far as I see nothing wrong with this solution. It reminds me of how Infor explodes BOM's - the only difference is they track the levels.

I am doing a project to print an Order's Lead times and need to explode BOMs with Level tracking. Can you give me an idea how Infor might have exploded their BOMs?