Version Query Output after Insert, Update and Delete

223 views Asked by At

Following is a question related to Oracle SQL Expert exam and have 4 choices. It says the correct answer is C. But I have a doubt and think that D should be the answer as this uses Oracle FlashBack technique. Can anybody explain this please.

Thank you.

Q)Evaluate the following statements:

CREATE TABLE digits
(id NUMBER(2),
description VARCHAR2(15));
INSERT INTO digits VALUES (1,'ONE');
UPDATE digits SET description='TWO' WHERE id=1;
INSERT INTO digits VALUES (2, 'TWO');
COMMIT;
DELETE FROM digits;
SELECT description FROM digits
VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;

What would be the outcome of the above query?

A. It wouldnot display any values.

B. It would display the value TWO once.

C. Itwould display the value TWO twice.

D. It would display the values ONE, TWO, and TWO.

Answer: C

1

There are 1 answers

0
ninesided On BEST ANSWER

This is a bit of a trick question, but the answer is indeed C, because the original value of "ONE" was never committed, both records were added in the same transaction and as a result there is only one "version" containing two rows, both with a description of "TWO".