Oracle Dual Table is a special table designed to give instant result for queries that don’t require a table.
Suppose we want to perform a arithmetic calculations or want to call functions, then we don’t need to fetch data from any table.
Example:
SELECT 30 + 10 FROM dual;
This query will directly perform the calculation and give us the result.
Oracle Dual Table contains one column named ‘DUMMY’ with data type VARCHAR2 and just one row with default value x.
It belongs to the schema of SYS user but it can be accessed by all other users.
Some Examples Using Dual Table
1. To view the dual table
If we simply, want to view the Dual Table we can use this query.
SELECT * FROM dual;
Result:
2. To call a Single Row Function
We can use any single row functions that don’t require a table using Dual Table, lets have a look
SELECT CONCAT ('Oracle', 'SQL') FROM dual;
This query will concatenate or join the 2 separate strings ‘Oracle’ and ‘SQL’.
Result:
3. Performs calculations using DUAL table
We can perform arithmetic calculations very easily using DUAL Table.
SELECT 19 * 18 FROM dual;
We saw how we can perform calculations and call functions and instantly get result using DUAL table.
Result:
In this tutorial, we learned more about the Oracle Dual Table.