QuestionQ195

VerifiedCreating Other Schema Objects

A simple view, SCOTT.DEPT_VIEW, exists on the SCOTT.DEPT table.

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 could be the problem?

Explanation

An insert through a simple updatable view inserts into its underlying table. Because no value is supplied for SCOTT.DEPT.DEPTNO, the attempted base-table row has a NULL DEPTNO, which violates that table's NOT NULL constraint. This is a constraint violation on the detail (base) table.

Community Discussion

No comments yet. Be the first to start the discussion!