创建同义词的时候遇到如下错误,现在已搞清楚,特记录下来以备后忘
SQL>conn system/oracle;SQL> create synonym d for scott.dept;
Synonym created.
SQL> select * from d;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> conn scott/oracle;
Connected.
SQL> select * from d;
select * from d
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select * from system.d;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
在scott用户下 执行select * from d时报错,执行 select * from system.d却不报错
原因:scott用户下 执行select * from d时是在scott.d里查找,执行 select * from system.d时,是在system.d下查找 ,而system.d指向的恰恰是scott.dept...
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23446692/viewspace-692776/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23446692/viewspace-692776/
本文记录了在Oracle数据库中创建同义词时遇到的权限问题,并详细解释了为何从不同用户下查询同义词会得到不同的结果。通过具体实例说明了同义词的指向及查询原理。
932

被折叠的 条评论
为什么被折叠?



