cancel
Showing results for 
Search instead for 
Did you mean: 

Recursive procedure calls?

stefan_kittler
Explorer
0 Kudos

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/check_call.cc:308" 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?

Regards

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

former_member182114
Active Contributor
0 Kudos

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

stefan_kittler
Explorer
0 Kudos

Hi Fernando

do you know whether there are any plans to change this in the future, so that recursive calls are possible?

Regards

Stefan

former_member182114
Active Contributor
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

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

http://www.btw-2013.de/proceedings/SQLScript%20Efficiently%20Analyzing%20Big%20Enterprise%20Data%20i...

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?

Former Member
0 Kudos

Hi Rodrigo,

Recursive Procedure calls are not implemented currently in SAP HANA.

But can be achieved via EXEC calls using result view.

Let me know if you were able to  achieve your use case or we shall discuss on the same.

Regards,

Anjali.

Former Member
0 Kudos

Hi Anjali,

We also have similar requirement where we need to call the same procedure recursively. Do you mean we cant achieve this in HANA??

Kindly give me sample example of alternative solution for this.

Thanks in advance.

Best Regards,

Krishna.

Former Member
0 Kudos

Hello Anjali,

I have a requirement in my project to come up with a hana model for BOM. This can be achieved in SQLScript using loops / cursors. Is there a better way of doing it? I would appreciate any help you can give.

Thanks,

Aamod.

Former Member
0 Kudos

Aamod I have a similar issue. Did you get any further on this?