What is the dual table in Oracle __oracle

Source: Internet
Author: User

Dual is a virtual table that forms the grammar rules for Select, and Oracle guarantees that there will always be a single record in dual. We can use it to do a lot of things as follows:

1, view the current user, you can execute the following statement in SQL Plus

SQL code
Select User from Dual;

2, used to call the system function

SQL code
Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;--to get current system time


Select Sys_context (' USERENV ', ' TERMINAL ') from dual;--get host name
Select Sys_context (' USERENV ', ' language ') from dual;--to get the current locale
Select Dbms_random.random from dual;--to obtain a random number

3, get the next value of the sequence or the current value, with the following statement

SQL code
Select Your_sequence.nextval from dual;--to get the next value of the sequence Your_sequence
Select Your_sequence.currval from dual;--to obtain the current value of the sequence Your_sequence

4, can be used as a calculator SQL code
Select 7*9 from dual

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.