How to Use the Dual Table
Imagine you wanted to display the date 90 days from now using a select statement in Oracle. Your select statement would require a "from" clause that references
one or more tables. But if you don't have a particular table in mind, as would be the case in this scenario, what table might you reference? The answer is the
dual table that is provided for scenarios like displaying a date. The table itself is trivial, just one column and one row of data!
To learn how to use the
dual table, follow these steps:
- You'll need to download and install Oracle 12c. The instructions for the setup can be found in How to use sample schemas. Follow steps 1 through 4 before proceeding to the next step.
- Let's try selecting the date 90 days from now using the
dualtable. Type in the following select statement and then hit Enter:
- You can format the date as well: