DUAL TABLE

DUAL TABLE
Dual is a small Oracle worktable, which consists of only one row and one column, and contains the value X in that column. Besides arithmetic calculations, it also supports date retrieval and it’s formatting.
Often a simple calculation needs to be done, for example, 4*4. The only SQL verb to cause an output to be written to a VDU screen is SELECT. However, a SELECT must use a table name in its FROM clause, otherwise the SELECT fails.

When an arithmetic exercise is to be performed such as 4*4 or $/2 etc, there really is no table being referenced, only numeric literals are being used.

To facilitates such calculations via a SELECT, Oracle provides a dummy table called DUAL, against which SELECT statements that are required to manipulate numeric literals can be fired, and output obtained.

EXAMPLE: -
SQL> SELECT 16/2 from DUAL;

OUTPUT: -
16/2
---------
8
SYSDATE
SYSDATE is a pseudo column that contains the current date and time. It requires no arguments when selected from the table DUAL and returns the current date.
EXAMPLE: -
SQL> SELECT sysdate from DUAL;

SYSDATE
---------
20-April-05

Post a Comment

Previous Post Next Post