My Question?
==============
SQL>
select * from v$version;BANNER
------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 -
Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
show user;USER is "IGS_DST"
SQL>
desc igs_dst.tab Name Null? Type
----------------------------- -------- --------------------
TNAME NOT NULL VARCHAR2(30)
TABTYPE VARCHAR2(7)
CLUSTERID NUMBER
SQL>
select * from igs_dst.tab;select * from igs_dst.tab
*
ERROR at line 1:
ORA-00942: table or view does not exist
===============
Answer:
DESC时如果指定了方案限定词时是查找用户的表,视图,私有同义词或者公有同义词; 而SELECT的时候,如果指定了方案限定词,不会去查找公有同义词,所以才有这样的差别。
===============
Select TAB view define in Oracle:
SQL>
select text from sys.all_views where owner='SYS' and view_name ='TAB';TEXT
------------------------------------------------------------
select o.name,
decode(o.type#, 2, 'TABLE', 3, 'CLUSTER',
4, 'VIEW', 5, 'SYNONYM'), t.tab#
from sys.tab$ t, sys.obj$ o
where o.owner# = userenv('SCHEMAID')
and o.type# >=2
and o.type# <=5
and o.linkname is null
and o.obj# = t.obj# (+)
SQL>
select userenv('SCHEMAID') from dual;USERENV('SCHEMAID')
-------------------
507
==================
SQL>
create table aa(a int);Table created.
SQL>
create synonym syn_aa for aa;Synonym created.
SQL>
desc igs_dst.syn_aa; Name Null? Type
----------------------------- -------- --------------------
A NUMBER(38)
SQL>
select * from igs_dst.syn_aa;no rows selected
==================
SQL>
drop synonym syn_aa;Synonym dropped.
SQL>
create public synonym syn_aa for aa;Synonym created.
SQL>
desc igs_dst.syn_aa; Name Null? Type
----------------------------- -------- --------------------
A NUMBER(38)
SQL>
select * from igs_dst.syn_aa;select * from igs_dst.syn_aa
*
ERROR at line 1:
ORA-00942: table or view does not exist
More Info See:
http://vecentli.itpub.net/post/14011/66066
阅读(2402) | 评论(0) | 转发(0) |