- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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
- 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
- What is the purpose of “NOT NULL WITH DEFAULT” clause used in DB2 table column?
- How to use SQLCA in a COBOL-DB2 program? What is the purpose of SQLCA?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- 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?
- What is the purpose and usage of ATOMIC and NON-ATOMIC clause in multi row insert?
- What is the purpose and usage of SCROLLABLE CURSOR in COBOLDB2 program?
- How to filter data using where Clause, “BETWEEN” and “AND” in Android sqlite?
- What is the usage of “@” symbol in MySQL stored procedure?
- Implementation of restart logic in a COBOL-DB2 program
- Steps involved in compilation of a COBOL-DB2 program
- How to filter data using where Clause and “IS NOT” in Android sqlite?