nerdexam
Oracle

1Z0-061 · Question #313

There is a simple view SCOTT.DEPT_VIEW on the table SCOTT.DEPT. This insert fails with an error: SQL> insert into dept_view values('SUPPORT','OXFORD'); insert into dept_view…

The correct answer is A. There is a NOT NULL or PRIMARY KEY constraint on DEPT.DEPTNO. B, C, D. B is wrong because constraints are enforced on detail tables, not on views. C and D are wrong because the error message would be different.

Creating Other Schema Objects

Question

There is a simple view SCOTT.DEPT_VIEW on the table SCOTT.DEPT. This insert fails with an error:

SQL> insert into dept_view values('SUPPORT','OXFORD'); insert into dept_view values('SUPPORT','OXFORD') * ERROR at line 1:

ORA-01400: cannot insert NULL into ("SCOTT"."DEPT"."DEPTNO") What might be the problem? (Choose the best answer.)

Options

  • AThere is a NOT NULL or PRIMARY KEY constraint on DEPT.DEPTNO.
  • BThe INSERT violates a constraint on the view.
  • CThe view was created as WITH READ ONLY.
  • DThe view was created as WITH CHECK OPTION.

How the community answered

(24 responses)
  • A
    75% (18)
  • B
    4% (1)
  • C
    13% (3)
  • D
    8% (2)

Explanation

B, C, D. B is wrong because constraints are enforced on detail tables, not on views. C and D are wrong because the error message would be different.

Topics

#view insert#NOT NULL constraint#primary key#view DML error

Community Discussion

6
Dervla O.Dervla O.Jun 24, 2026

The error code tells you everything you need to know. ORA-01400 is Oracle's "cannot insert NULL" error, and the column it names is DEPT.DEPTNO on the base table, not anything on the view itself. When you insert through a simple view without specifying a value for every underlying NOT NULL or PRIMARY KEY column, Oracle tries to pass NULL for the missing column and the base table constraint fires. So the answer is A. The other options are worth ruling out quickly. WITH READ ONLY would throw ORA-42399, not ORA-01400. WITH CHECK OPTION raises ORA-01402 when a row would fall outside the view's WHERE clause. Neither of those matches what you see here. The constraint lives on the table, the view is just the path through which the violation surfaces.

21
Mei-Ling H.Mei-Ling H.May 27, 2026

I almost picked B, but ORA-01400 points to the base table column, not the view.

2
Hiroshi T.Hiroshi T.Jun 12, 2026

WITH CHECK OPTION blocks inserts that fail view predicate validation, causing ORA-01400 here.

-1
Dervla O.Dervla O.Jun 13, 2026

Hiroshi, the ORA-01400 is a NOT NULL violation thrown by the base table constraint itself, not WITH CHECK OPTION, so A is correct because the insert fails before the view filter even gets a chance to evaluate.

0
Anjali D.Anjali D.Jun 5, 2026

B makes the most sense to me here, because the error is being thrown at the view level during the insert, and if the view itself has a constraint defined on it, Oracle would enforce that before even touching the base table. Has anyone else been going back and forth on this one? Would love to hear if your group landed somewhere different.

-2
Mei-Ling H.Mei-Ling H.Jun 7, 2026

Actually Anjali, the answer is A, because Oracle performs the DML on the base table first and enforces base table constraints at that level before the view's WITH CHECK OPTION is ever evaluated, so the error originates from the base table, not the view layer. The view constraint check comes after the underlying insert is attempted, which is the key order-of-operations detail the question is testing.

0
Full 1Z0-061 Practice