17,141
社区成员




[TEST@ora10gr1#2009-12-18/08:06:45] SQL>desc t1;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER
NAME VARCHAR2(10)
[TEST@ora10gr1#2009-12-18/08:06:47] SQL>create or replace view t1_view as select * from t1
View created.
[TEST@ora10gr1#2009-12-18/08:07:03] SQL>select * from t1_view;
no rows selected
[TEST@ora10gr1#2009-12-18/08:07:14] SQL>select * from t1;
no rows selected
[TEST@ora10gr1#2009-12-18/08:07:45] SQL>insert into t1_view values(1,'a');
1 row created.
[TEST@ora10gr1#2009-12-18/08:07:49] SQL>select * from t1_view;
ID NAME
---------- ----------
1 a
[TEST@ora10gr1#2009-12-18/08:07:56] SQL>select * from t1;
ID NAME
---------- ----------
1 a
--select 后面直接加。。。。。
[TEST@ora10gr1#2009-12-18/08:07:59] SQL>select * from t1 with read only;
select * from t1 with read only
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
SQL> select * from t_row_str with read only;
select * from t_row_str with read only
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
--可以更新的
create or replace view view_a as
select xxx from table_name;
--不可以可以更新的
create or replace view view_a as
select xxx from table_name1 a,table_name2 b where a.xxx=b.xxx;
--还有很多种情况不允许更新呢,比如视图中用了distinct、group by 等
create or replace view view_a as
select xxx from table_name with read only;
create or replace view view_a as
select xxx from table_name where id < 10 with check option;