ORACLE WITH CHECK OPTION子句详解
今天一个朋友在问关于创建视图时候WITH CHECK OPTION是什么意思,我当时也没多想,就比较笼统的回答了一下。后来自己想了想,好像自己也记不太清楚了,脑子里只有个大概的印象。
好了话不多说,下面还是通过实验来看一下吧。
C:\Documents and Settings\Admin>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Nov 14 20:22:13 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> show user
USER is ""
SQL> conn scott/tiger
Connected.
SQL> drop table t1;
Table dropped.
SQL> create table t1(id number,name varchar2(20));
Table created.
SQL> insert into t1 values(1,'wh')
2 ;
1 row created.
SQL> insert into t1 values(2,'wp');
1 row created.
SQL> insert into t1 values(3,'wr');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NAME
---------- --------------------
1 wh
2 wp
3 wr
SQL> create view v_t1
2 as
3 select * from t1
4 where id=2
5 with check option;
View created.
首先来看一下INSERT
SQL> insert into v_t1 values(1,'haha');
insert into v_t1 values(1,'haha')
*
ERROR at line 1:
ORA-01402: view WITH CHECK OPTION where-clause violation
--这里由于视图中定义了where id=2的条件并且加有with check option子句,所以插入id=1的记录就会报错。
SQL> insert into v_t1 values(2,'haha');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NAME
---------- --------------------
1 wh
2 wp
3 wr
2 haha
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
今天在一个帖子里看到shiyiwan的回帖中提及到了两个自己以前没见过的概念,save exception和dml error logging。上网搜了搜相关内容,看了看大概明白意思,不过在实际运用中还是没怎么用过。保存下来,以后用的到的话方便查阅。
这一篇是关于save exception的,另外一篇dml error logging的参见如下链接
http://blog.csdn ......
Oracle Process Structure
Oracle takes advantage of various types of processes:
—User process: Started at the time a database user requests connection to the Oracle server
—Server process: Connects to the Oracle instance and is started when a user establishes a session
& ......
目录
==================================================================
1.带空值的排列
2.Top/Bottom N查询
3.First/Last排名查询
4.按层次查询
一、带空值的排列:
假如被排列的数据中含有空值呢?
SQL> select region_id, customer_id,
2 ......
oracle中连接与会话不是一个概念!!!
在Oracle中,连接只是客户进程和数据库实例之间的一条特殊线路,最常见的就是网络连接。这条连接可能连接到一个专用服务器进程,也可能连接到调度器。如前所述,连接上可以有0个或多个会话,这说明可以有连接而无相应的会话。另外,一个会话可以有连接也可以没有连接。使用高级Oracle N ......