Skip to Content

SAP HANA Stored procedure without any input parameter

I need to create a stored procedure that updates the root account id for a account in a table. Mainly I can use ancestor hierarchy function to find the root node for each account , but how can I find the root account id and update that for each account in my table if that needs to be done for each and every record of a table, and without passing any input parameter in the procedure. Can I use for loop on the table and fetch each record and then find its root account and update ?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Oct 14, 2019 at 07:21 AM

    I think there are more solutions for your requirement. But without more details it is hard to give the right direction. What of course works is to use a SQLScript cursor which allows you to process every record you need to analyze. As you said a for loop in combination with an index-based cell access would work too.

    But keep in mind that both options are not the best regarding performance.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 14, 2019 at 04:33 PM

    why can't use Table functions, Stored procedure best used with input parameter.

    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.