开发者

I expect an error but I dont get what I would think

开发者 https://www.devze.com 2023-04-10 17:56 出处:网络
I create a view SQL> create view DEPT20 AS 2select empno AS Employee_ID_ID,ename AS Employee, deptno as Department_ID from emp

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消