View & DML
来源:互联网 发布:相贯线切割机编程 编辑:程序博客网 时间:2024/05/20 03:40
Rules for Performing DML Operations on a View
You cannot add data through a view if the view includes:
Group functions
A GROUP BY clause
The DISTINCT keyword
The pseudo column ROWNUM keyword
Columns defined by expressions
NOT NULL columns in the base tables that are not selected by the view
如果创建视图的基表中包含非空约束。
你创建的视图中不包含非空列,那么你不能对这个视图进行插入操作。
SQL> create table CUST
2 (
3 CUST_ID NUMBER(2) not null,
4 CUST_NAME VARCHAR2(15),
5 E_NAME LONG
6 );
Table created
SQL> create or replace view v as select cust_name from cust;
View created
SQL> insert into v values('ORACLE');
insert into v values('ORACLE')
ORA-01400: 无法将 NULL 插入 ("REPORT"."CUST"."CUST_ID")
因为cust_id 定义为非空,在视图中没有包含非空列。所以不能对cust表进行插入操作。
SQL> create or replace view v as select cust_id ,cust_name from cust;
View created
SQL> insert into v values(1,'ORACLE');
1 row inserted
SQL> create or replace view v_emp as
2 select * from emp where emp_no = 10 with check option;
View created
SQL> update v_emp set emp_no=11 where emp_no=10;
update v_emp set emp_no=11 where emp_no=10
ORA-01402: 视图 WITH CHECK OPTION where 子句违规
SQL> create or replace view v_emp as
2 select * from emp where emp_no = 10 with read only;
View created
SQL> update v_emp set emp_no=11 where emp_no=10;
update v_emp set emp_no=11 where emp_no=10
ORA-42399: 无法对只读视图执行 DML 操作
- View & DML
- DML
- DML
- DML
- DML
- DML
- 2.View the Exhibit to examine the description for the SALES table. Which views can have all DML oper
- DDL.DML
- DML知识
- DML触发器
- DML详解
- DML总结
- Oracle DML
- database DML
- 数据库DML
- 基本DML
- DML触发器
- DML DDL
- Symbian -打开系统浏览器浏览网页
- STL Container5: MultiMap
- keelkit数据库连接字符串的设置
- CvSize结构
- Internet 服务总线
- View & DML
- 软件设计师完美通过
- STL Container6: Set
- Ubuntu关于复制粘帖的技巧
- STL Container7: muiltiset
- 六级考试
- 领带的10种打法
- ssh2整合OA问题集
- Sqlserver2005优化查询速度51法