Advanced PowerBuilder

HomePrevious Lesson: Non-Repeatable Reads
Next Lesson: The FETCH Statement

Phantom Rows

A phantom row occurs when one transaction reads a set of rows which satisfy search criteria, before a second transaction modifies the data (through an INSERT, DELETE, UPDATE and so on). If the first transaction repeats the read with the same search conditions, it obtains a different set of rows.

Suppose Tran1 issues the following SELECT statement:
SELECT count(*) FROM product_master
WHERE product_balance < product_reorder_level;

and gets 75 rows. If Tran2 then does some processing, which makes the product_balance of another 10 items fall below the product_reorder_level, and now when Tran1 issues the same statement again, it gets 85 rows instead of 75.

The difference between "No-Repeatable reads" and "Phantom Reads" is that, the former one is dealing with a single row value, where as the later is dealing with the result from a set of rows.
HomePrevious Lesson: Non-Repeatable Reads
Next Lesson: The FETCH Statement