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:

  1. 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.
  2. Let's try selecting the date 90 days from now using the dual table. Type in the following select statement and then hit Enter:
    Display date 90 days from now
  3. You can format the date as well:
    Display formatted date 90 days from now
Author: Stephen Withrow


About Webucator
