DUAL table in Oracle

DUALtable is a special single row table present by default in Oracle Databases.Structure of DUAL table
DUAL table has only one column called DUMMY as Varchar2(1) data type and value as X.

1) select 1 from DUAL;
returns 1

2) select 1+2 from DUAL;
returns 3

3) select sysdate from DUAL;
returns system date of oracle database.

4) select `sql` from DUAL;

5) select user from DUAL;
returns oracle user logged in.

6) select 
   (select empno from emp where empno = 10)
   from DUAL;
returns 10

DUAL table can be used to test the SQL functions ( Both in-built and user defined functions)

7) select func_salary(10) from DUAL;
where func_salary is a user defined function returns a value when argument is 10.

8) select LOWER(`ORAclE`) from DUAL;
returns`oracle` where LOWER is a in-built SQL function.

DUAL table can be used in SQL and PL/SQL.


One thought on “DUAL table in Oracle

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s