Dual Table in Oracle

DUAL - default oracle table with only one column DUMMY VARCHAR2(1) and it contains single row with value 'X' in SYS user schema. Used for computing a constant expression and to select a constant, pseudocolumn (sysdate) or expression from any table.

Syntax: SQL> select * from dual;


Result:
DUMMY
----
X

Examples:
Used to call Inbuilt function:
SELECT UPPER('Welcome to Forget Code!!') FROM DUAL;


Result :
WELCOME TO FORGET CODE!!

Used to computing expression
SELECT (10+20)/2 FROM DUAL;


Result :
(10+20)/2
-----------
15


Sysdate
SELECT SYSDATE FROM dual;


RESULT
SYSDATE
---------
14-AUG-18

CHANGE FORMAT of sysdate:
SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY') FROM DUAL;


Output:
TO_CHAR(SYSDATE, 'DD-MON-YYYY')
---------------------------------------
14-AUG-18

DELETE DUAL TABLE:
DELETE FROM DUAL;


Output:

DELETE FROM DUAL
*
ERROR at line 1:
ORA-01031: insufficient privileges


TURNCATE DUAL TABLE:
Syntax: DELETE FROM DUAL;


Output:
DELETE FROM DUAL
*
ERROR at line 1:
ORA-01031: insufficient privileges