某日看代码,发现在代码中有一个tab,起的作用和dual差不多,于是就想两者之间的区别,查到资料如下:
Tab is a view, as seen:
create or replace view sys.tab as
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# ( )
Dual is a table with a unique column.
This column is a dummy varchar, that returns what you type.
That´s why if you type select * from dual, the result will be 'X'.
参考资料:
http://en.allexperts.com/q/Oracle-1451/tab-dual-1.htm
本文探讨了Oracle数据库中Tab视图和Dual表的区别。Tab视图显示了当前模式下的表、簇、视图和同义词等信息。而Dual表则是一个只包含一个VARCHAR2类型列的特殊表,用于返回任何单行查询。

617

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



