Category: 

What Is a DUAL Table?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 07 November 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The great magician and escape artist Harry Houdini died on Halloween in 1926.  more...

December 11 ,  1946 :  UNICEF was established.  more...

The DUAL table is a special table exclusive to Oracle® databases that has just one column and one row, so only one piece of datum is in there. The main reason for the DUAL table is convenience, because it makes coding certain database functions easier. Unlike other tables in the database, which are meant to be modified and changed, the DUAL section is not supposed to be altered. If this section is changed at all, terrible errors can occur and the entire database may eventually become corrupted. The DUAL section is primarily used in conjunction with pseudo columns and calculations that need a table.

In the DUAL table, there is only one row and one column, so it only has a single piece of information. By default, the column is called DUMMY, and the value contained within the cell is X, which makes it useful for X-based calculations. SYS, short for "system", is the owner of the DUAL cell. All SYS data are meant to be left alone and not changed.

Ad

Users are able to change DUAL table information with a few simple formulas and can inject their own information into the cell. While this can be done, it is not meant to be and never should be. If the default X is changed to anything else, catastrophic problems can occur with the database, including corruption of the data. This is because DUAL is used automatically in some formulas and, if the X is different, corrupted code will be introduced to the database.

In many database queries, or formulas, a FROM clause is required. Normally, when this clause is used in a database for the query, a table has to be specified. The table is where the calculation is done, or where the information comes from, which is why it is needed in most normal functions. If a table is not needed or not required for the calculation, then the DUAL table can be specified. This will allow the query to work without introducing a table.

Along with queries, the DUAL table offers another advantage. Less coding is needed to use a DUAL section and, while the coding is slight, larger databases will see improved performance. With less query coding, the database will be able to work quicker. It also is useful in calculations that have consistent integers and those that can make use of the blank X integer without requiring the cell to change.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email