- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the purpose and usage of â€śWHERE CURRENT OFâ€ť clause in a COBOL-DB2 program?
The “WHERE CURRENT OF” clause will place the exclusive lock on the row once the UPDATE statement is executed. The “WHERE CURRENT OF” clause will point to the most recently fetched row of the cursor.
We can update the rows in cursor using “WHERE CURRENT OF” in the following way.
EXEC SQL DECLARE ORDER_CUR CURSOR FOR SELECT ORDER_ID, TRANSACTION_ID FROM ORDERS WHERE ORDER_DATE = ‘2020-07-28’ END-EXEC
EXEC SQL OPEN ORDER_CUR END-EXEC
FETCH cursor and Update row
SET WF-END-CURSOR-N TO TRUE PERFORM UNTIL WF-END-CURSOR-Y EXEC SQL FETCH ORDER_CUR INTO :ORDER-ID, :TRANSACTION-ID END-EXEC IF TRANSACTION-ID NOT = SPACES EXEC SQL UPDATE ORDERS SET IS_PAID = ‘YES’ WHERE CURRENT OF ORDER_CUR END-EXEC ELSE CONTINUE END-IF END-PERFORM
- Related Articles
- What is the purpose and usage of â€śFOR UPDATE OFâ€ť clause in a COBOL-DB2 program
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- What is the purpose and usage of SQLCODE within the SQLCA in a COBOL-DB2 program
- What is the usage and purpose of DCLGEN and host variables used in COBOL-DB2 program
- How to use SQLCA in a COBOL-DB2 program? What is the purpose of SQLCA?
- What is the purpose of the "FOR UPDATE OF" clause in a cursor? What will happen if we fire an UPDATE statement without using this clause in a COBOL-DB2 program?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- What is the purpose and usage of ATOMIC and NON-ATOMIC clause in multi row insert?
- What is the purpose of â€śNOT NULL WITH DEFAULTâ€ť clause used in DB2 table column?
- What is the purpose and usage of SCROLLABLE CURSOR in COBOLDB2 program?
- Steps involved in compilation of a COBOL-DB2 program
- Implementation of restart logic in a COBOL-DB2 program
- Impact of database downtime on the COBOL-DB2 program
- How to precompile a COBOL-DB2 program?
- What is the definition and usage of alternate key in a DB2 table?