创建同义词的时候遇到如下错误,现在已搞清楚,特记录下来以备后忘
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博客 ” ,链接:https://blog.itpub.net/23446692/viewspace-692776/
,如需转载,请注明出处,否则将追究法律责任。