Subject Re: [firebird-support] Recursive procedure call (SP)
Author Ann Harrison
Tanz Anthrox wrote:

>Is it possible to execute procedures recursively?

> And, I tried to check the infinite loops in BOM definiton.
> Is there any easy way to achieve this problem?

I'm not exactly sure what you're asking for.

Do you want to set up the data definitions so you can't define a part to be a component of itself? If so, you could write a trigger that invokes a recursive procedure. The procedure examines the components of a part and their components, comparing the part number with the initial part number passed in. If that number is found, the procedure reports back to the trigger that the part has a problem.

Or, do you want to avoid an infinite recursion when developing the BOM? Firebird eventually reports an error after some number of recursions... I don't remember how many. A more civilized mechanism is to include a counter in your procedure parameters. Increment it each time you recurse and stop when the counter reaches an unreasonable level.