I need to delete rows from different db2 tables in COBOL with commit in between after some 100 or 200 rows. Is there any away I can restrict my delete statement for some particular rows as in Select for fetch first 100 rows only. The values of table names will be known only during the execution of the program. I thought of trying first select with fetch first 100 rows and use delete where current of option. So I prepared my dynamic sql of select with fetch first 100 rows only and executed fetch statement. Now when I run my delete statement with current of using Execute Immediate, the delete statement is failing. It?s not able to point to the row fetched before. I am executing my delete statement only before the closing the cursor. Without dynamic sql this select and delete current of works fine. It would be a great help if you could give a solution for this.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!