# Recursive call with DB/2

**URL:** <https://techcommunity.softwareag.com/t/recursive-call-with-db-2/60380>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [December 7, 2005, 12:41pm UTC](https://techcommunity.softwareag.com/t/recursive-call-with-db-2/60380 "2005-12-07T12:41:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garth\_Endacott](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@Garth\_Endacott](https://techcommunity.softwareag.com/u/Garth_Endacott)\
**Post date:** [December 7, 2005, 12:41pm UTC](https://techcommunity.softwareag.com/t/recursive-call-with-db-2/60380/1 "2005-12-07T12:41:06Z")

</div>

Hi All,  
I have a problem calling a recursive routine in Natural DB/2. On the second call it returns a SQLSTATE error 24502 - cursor already open. The call is done within the loop of a Select statement. Some of the information I have gleaned from Google, seems to indicate that DB/2 only allows recursion if the SQL statements are within the context of a stored procedure.

Any comments and/or source code 🙂

Thanks  
Garth

Natural 3.1.06  
DB/2 ??

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [December 23, 2005, 9:10pm UTC](https://techcommunity.softwareag.com/t/recursive-call-with-db-2/60380/2 "2005-12-23T21:10:01Z")

</div>

Sorry, Garth, not a solution:  
but we have some experience in our project. If You could provide the relevant source code of Select and nested Calls, we could have a look.

kind regards and a happy new year!  
Friedhelm  
[http://www2.softwareag.com/de/solutions/XML\_Solutions/Abag/default.asp](http://www2.softwareag.com/de/solutions/XML_Solutions/Abag/default.asp)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/recursive-call-with-db-2/60380/3 "2021-04-02T14:40:22Z")

</div>


