Version Query Output after Insert, Update and Delete

萝らか妹 提交于 2020-01-24 14:42:46

问题


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:


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".



来源:https://stackoverflow.com/questions/30755192/version-query-output-after-insert-update-and-delete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!