Skip to Content

Recursive procedure calls?

Hi experts

I have the following problem:

I try to implement a requirement where I need recursive procedure calls. I have a procedure that calls another procedure that, in certain cases, calls the first one again. If I try to activate the procedure I get a "invalidated procedure" "at ptime/query/checker/" error. Is it possible to have recursive procedure calls, if yes, what do I have to do to get them activated? Or does this error message mean something colpletely else?



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Nov 15, 2012 at 05:53 PM

    Hi Stefan,

    HANA have a different behavior when activating things.

    When you try to activate a procedure or an object HANA will look for all called objects to create the "plan execution" optimized for this procedure/object considering everything that is called.

    As your scenario is call back for HANA optimizer can't create the correct plan and reach this error.

    On other languages it's totally difference because on activation you don't even need to check the called objects because their build code is totally independant.

    Regards, Fernando Da Rós

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stefan,

      I'm not engaged but I don't think there's a plan for this.

      You still have one option, but I'll not go for it if it's impossible to survive without it.

      You can the source one coding dynamic execution with command EXEC, see details in SQL Script guide, but see also the recomendation:

      "Avoid Using Dynamic SQL: Executing dynamic SQL is slow because compile time checks and

      query optimization must be done for every invocation of the procedure. Another related

      problem is security because constructing SQL statements without proper checks of the

      variables used may harm security."

      And would also add that it's not trackeable, if the name or parameters of called procedure changes you may only face errors when runtime, so it's also a bad design use it.

      Anyhow it's an option.

      Regards, Fernando Da Rós

  • author's profile photo Former Member
    Former Member
    Posted on Nov 05, 2013 at 02:00 PM


    I am interested on recursive calls too. Googling around, I found an interesting article about using SAP Hana, as follows:

    It seems that at least of the members is a SAP employee. On the article page 376 (or the PDF page 14) we can see that SQLScript is handling recursive calls.

    Do any of you guys were able to recursive call procedures, as described in the article, or are you still handling this with EXEC calls?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.