QUESTION: 11

On 20 de July de 2007, in 1Z0-001, OCA (PL/SQL Developer), ORACLE, by Fabiano Anjos

The view EMP_VIEW is created based on the EMP table as follows:

CREATE OR REPLACE VIEW emp_view AS
SELECT deptno
, SUM(sal) TOT_SAL
, COUNT(*) TOT_EMP
FROM emp;
GROUP BY deptno;

What happens when the command is used?

UPDATE emp_view
SET tot_sal = 20000
WHERE deptno = 10;

A: The base table cannot be updated through this view.
B: The TOT_SAL column in the EMP table is updated to 20000 for department 10.
C: The TOT_EMP column in the EMP table is updated to 20000 for department 10.
D: The SAL column in the EMP table is updated to 20000 for employees in department 10.

ANSWER: A

EXPLANATION: Answer A is correct because the user may not INSERT, DELETE, or UPDATE data on the table underlying the sample view if the SELECT statement creating the view contains GROUP BY, or a single-row operation.

INCORRECT ANSWERS:

B: TOT_SAL column in the EMP table will not be updated.
C: TOT_EMP column in the EMP table will not be updated for any rows.
D: UPDATE command does not contain SAL column for update.

 

Comments are closed.