Skip to Content
author's profile photo Former Member
Former Member

loop over table variable

I am writing a calculation view, and unfortunately, I must loop over a table variable, because I need to update a row on the current row based on the value of the prior row (old COBOL control break logic). How do I do this? I tried to use a cursor and it did not work.



P.S. I already know that this will not be the efficient, but it is the only way that I can think of to accomplish my task.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Aug 24, 2012 at 02:26 PM

    Hi Raphael,

    Are you trying to write a procedure to update the table. The Calculation view is to display the data.

    Can you please post your code. It will be helpful in understand why it is not working as per your expectations.



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Raphael,

      Since you haven't posted the complete code, I am going ahead with some assumptions.

      - The var_out in general Calculation view is the output structure. It is not a cursor defined, hence you are getting the error message.

      - Secondly, what I believe is you need a procedure with SQL output (WITH RESULT VIEW). In the procedure you can update the table and then produce the output. You can refer to sample examples on Cursor in the document

      Hope this helps.



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.