CodeSnip: Practical Use of "for update of" in Oracle Cursor
page 1 of 5
Published: 07 Feb 2008
In this article, Deepankar examines the usage and application of the "for update of" cursor using Oracle 9i. He examines the concept with the help of a sample scenario. Initially, he provides the complete code listing followed by a detailed explanation. He finishes the discussion by examining the structure of the tables before and after coupon merging with the help of relevant screen captures.
by Deepankar Sarangi
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 25041/ 62


This code snip explains how to update the coupon field of more than one table, using data from a coupon table using "for update of" cursor. The condition is that:

1. No coupon can be used more than once from coupon table.

2. Coupons being valuable entity should not be tampered by any DML operation during merging into target table.

This scenario occurs when we are given with some coupon codes stored in a coupon table. The records from this table will be used to update certain tables one after the other. So the coupon table maintains a flag showing which coupons have already been used once and uses only those records, which are not yet been used.

For safety reasons the coupon field in person_table_1 are locked through explicit locking by "for update of" clause to deny access for the duration of a tractions.

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-14 2:25:53 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search