-
SQL语言基础中的参照完整性错误
资源介绍
参照完整性错误
*
UPDATE emp
*
ERROR at line 1:
ORA-02291: integrity constraint (USR.EMP_DEPTNO_FK) violated - parent key not found
SQL> UPDATE emp
2 SET deptno = 55
3 WHERE deptno = 10;
不存在第55号部门
*
Integrity Constraint Error
If you attempt to update a record with a value that is tied to an integrity constraint, you will experience an error.
In the example on the slide, department number 55 does not exist in the parent table, DEPT, and so you receive the parent key violation ORA-02291.
Note: Integrity constraints ensure that the data adheres to a predefined set of rules. A subsequent lesson will cover integrity constraints in greater depth.
Instructor Note
Explain integrity constraints and review the concept of primary key and foreign key.
- 上一篇: 基本内容-HDR数据库知识
- 下一篇: 参照另一个表来删除行-SQL语言基础