ora-01731
三月 27, 2008 – 3:15 下午今天测着玩,弄出来一个ora-01731的错误。
ORA-01731 circular view definition encountered
Cause: Through a series of CREATE and DROP VIEW statements, a view was defined that refers to itself. For example, VIEW1 might include a column from VIEW2 that is defined as a column in VIEW1. View definitions may be seen by querying the data dictionary.
Action: Check the view definitions, remove any circular references, and retry the
statements.
这个错误不是太常见,下面贴出测试过程:
SQL> conn sys/admin as sysdba
已连接。
SQL> create table sunwg (id number);
表已创建。
SQL> insert into sunwg values(1);
已创建 1 行。
SQL> commit;
提交完成。
SQL> create public synonym sunwg for sunwg;
同义词已创建。
SQL> grant select on sys.sunwg to sunwg;
授权成功。
SQL> conn sunwg/test
已连接。
SQL> create view v_sunwg as select * from sunwg;
视图已创建。
SQL> create view v_sunwg1 as select * from v_sunwg;
视图已创建。
SQL> create view sunwg as select * from v_sunwg1;
create view sunwg as select * from v_sunwg1
*
第 1 行出现错误:
ORA-01731: 出现循环的视图定义
oracle是不允许循环的视图定义的,真想知道如果允许视图循环定义会是个什么情况。><
2 Responses to “ora-01731”
请问你解决这个问题了么?今天我也出现了这个问题。麻烦解决告诉我。谢谢你。
By sky on 六 11, 2009
一般出这个问题都是视图的定义有问题
因为这种递归循环的视图定义是不允许的
By admin on 六 11, 2009