【转】详解Oracle的dual表

Posted on 2013-09-16 14:43  JasmineLiu  阅读(218)  评论(0编辑  收藏  举报
dual is a table which is created by oracle along with the data dictionary. It consists of exactly one column whose name isdummy and one record. The value of that record is X.
rene@ora92> desc dual
 Name                    Null?    Type
 ----------------------- -------- ----------------
 DUMMY                            VARCHAR2(1)

rene@ora92> select * from dual;

D
-
X
The owner of dual is SYS but dual can be accessed by everyuser.
As dual contains exactly one row (unless someone fiddled with it), it is guaranteed to return exactly one row in select statements. Therefor, dual is the prefered table to select apseudo column (such as sysdate
select sysdate from dual
Although it is possible to delete the one record, or insert additional records, one really should not do that!.

Copyright © 2024 JasmineLiu
Powered by .NET 9.0 on Kubernetes