Use of dual tables in Oracle

Source: Internet
Author: User


Dual is a virtual table used to form the select syntax rule. oracle ensures that there will always be only one record in dual. We can use it to do a lot of things, as shown below: 1. To view the current user, you can execute the following statement select user from dual in SQL Plus; 2. It is used to call the system function select to_char (sysdate, 'yyyy-mm-dd hh24: mi: ss') from dual; -- Obtain the current system time select SYS_CONTEXT ('userenv', 'terminal') from dual; -- Obtain the host name from dual; -- Obtain the current locale select dbms_random.random from dual; -- obtain a random number 3. Obtain the next value or current value of the sequence. Use the following statement to select your_sequence.nextval from dual; -- Obtain the next value of the sequence your_sequence select your_sequence.currval from dual; -- Obtain the current value of the sequence your_sequence. 4. You can use the calculator select 7*9 from dual;
From the column in Chinajash

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.