What is dual in oracle?

Source: Internet
Author: User

What is dual in oracle? What is dual? A: www.2cto.com dual is a system table and cannot be deleted or modified. Its name is "pseudo table" or "dumb table ". Check its table structure: is the name of SQL> desc dual empty? Type ----------- -------- ----------- DUMMY VARCHAR2 (1) the field has only one "dummy", and the Chinese name is "dumb ". The length is only 1. The table structure is for reference only. Q: What is the role of dual and how to use it? In Oracle, the primary reason for using dual is to calculate the value of the expression. For example, 99*99. The operation on dual tables can only be a query. Other operations such as adding, deleting, modifying, or modifying table structures have no practical application value and do not need to be studied. Moreover, Oracle may not be used. For example: www.2cto.com select 99*99 from dual; Return: 9801 can also calculate the value of multiple expressions at a time: Execute: select 9*9, 1 +/null from dual; return: 9*9 1 + 1 1/NULL --- ---------- 81 2 note that the result of "1/null" is null. In the database, if any value is computed with null, the result is null. Another common purpose is to query the current system date. The corresponding function is sysdate, that is, "system date ". Code: select sysdate from dual; Return: sysdate----------22-august 10-10 to make it easier to understand, you can use the to_char function to specify the explicit format. Select to_char (sysdate, 'yyyy. mm. dd') as current date from dual; Return: current date ---------- 2010.11.22 run: select to_char (sysdate, 'yyyy. mm. dd hh24: mi: ss') as current time from dual; Return: current time ----------------- 2010.11.22 11:28:44. In addition, after learning the sequence, you can know, the dual table is usually used to query the next and current values of a sequence. Conclusion: The dual table is mainly used to calculate expressions. · The table structure is only for parameters. The actual number of returned columns is related to the number of expressions. · A dual table may only return one row, but may not return multiple rows. Because the dual table does not retrieve data from the table.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.