Subject | Re: [firebird-support] Recursive procedure call (SP) |
---|---|
Author | Ann Harrison |
Post date | 2003-12-03T20:53:29Z |
Tanz Anthrox wrote:
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.
Regards,
Ann
>Is it possible to execute procedures recursively?Yes.
>
> And, I tried to check the infinite loops in BOM definiton.I'm not exactly sure what you're asking for.
> Is there any easy way to achieve this problem?
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.
Regards,
Ann