I create a view
SQL> create view DEPT20 AS
2 select empno AS Employee_ID_ID,ename AS Employee, deptno as Department_ID from emp
3 where deptno = 20
4 with check option constraint emp_dept_20;
View created.
I expect to get this error
ORA-01402: view WITH CHECK OPTION where-clause violation
开发者_Python百科But I dont get an error I get
SQL> update dept20
2 set department_ID=30
3 where Employee='Smith';
0 rows updated.
SQL>
Normally I like no errors but in this one I want the error when someone tries to go outside the allowed.
What happens if you run this SQL?
update dept20
set department_ID=30
where Employee='SMITH';
If you're using the canonical EMP table, all the employees' names are in uppercase.
精彩评论