Home  >  Article  >  Database  >  Oracle DUAL表的使用

Oracle DUAL表的使用

WBOY
WBOYOriginal
2016-06-07 16:58:301001browse

DUAL表:dual使系统表,它的拥有者是sys用户。不能够删除的,那么所有的用户都能够去访问。dual表又被称为虚表。在dual表中,只有

DUAL表:
dual使系统表,它的拥有者是sys用户。不能够删除的,那么
所有的用户都能够去访问。
dual表又被称为虚表。
在dual表中,只有一个字段。那么这个字段使dummy。

SQL> DESC DUAL;
 名称                                      是否为空? 类型
 ----------------------------------------- -------- ------------

 DUMMY                                              VARCHAR2(1)

SQL> SELECT * FROM DUAL;

D
-
X

dual表它是用来计算表达式或者是用它来测试。
比如说我们要查看当前的时间。
我们要使用sysdate函数。
例子:

SQL> SELECT SYSDATE FROM DUAL;

SYSDATE
----------
13-12月-10

要获得更详细的时间,使用SYSTIMESTAMP 函数
SQL> SELECT SYSTIMESTAMP FROM DUAL;

SYSTIMESTAMP
---------------------------------------------
13-12月-10 04.47.59.484000 下午 +08:00

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn