首页 » ORACLE » oracle create read only view创建只读视图

oracle create read only view创建只读视图

建立只读简单视图

SQL> create table test(id int,name varchar(20));

Table created.

SQL> insert into test(1,’anbob.com’);
insert into test(1,’anbob.com’)
*
ERROR at line 1:
ORA-00928: missing SELECT keyword

SQL> insert into test values(1,’anbob.com’);

1 row created.

SQL> insert into test values(2,’weejar.com’);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test;

ID NAME
———- —————————————-
1 anbob.com
2 weejar.com

SQL> create view v_t
2  is
3  select id,name from test;
is
*
ERROR at line 2:
ORA-00905: missing keyword

SQL> create view v_t
2  as
3  select id,name from test;

View created.

SQL> insert into v_t values(3,’a’);

1 row created.

SQL> commit;

Commit complete.

SQL> create view v_t_read
2  as
3  select id,name from test
4  with read only;

View created.

SQL> insert into v_t_read values(3,’a’);
insert into v_t_read values(3,’a’)
*
ERROR at line 1:
ORA-01733: virtual column not allowed here

打赏

对不起,这篇文章暂时关闭评论。