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

Stephen has over 30 years of experience in training, development, and consulting in a variety of technology areas including Python, Java, C, C++, XML, JavaScript, Tomcat, JBoss, Oracle, and DB2. His background includes design and implementation of business solutions on client/server, Web, and enterprise platforms. Stephen has a degree in Computer Science and Physics from Florida State University.

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.