Use of pseudo-table dual in Oracle

Source: Internet
Author: User

Dual is a virtual table that makes up the syntax rules for SELECT, and Oracle guarantees that there will always be only one record in dual. We can use it to do a lot of things, as follows:

1. To view the current user, you can execute the following statement in SQL Plus select User from dual;

2. Used to call system functions

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

Select Sys_context (' USERENV ', ' TERMINAL ') from dual;--get host name

Select Sys_context (' USERENV ', ' language ') from dual;--get current locale

Select Dbms_random.random from dual;--to get a random number

Select Concat (' 010-', ' 88888888 ') | | ' Ext. 23 ' telephone from dual;

3. Get the next value or the current value of the sequence, using the following statement

Select Your_sequence.nextval from dual;--to get the next value of the sequence Your_sequence

Select Your_sequence.currval from dual;--to get the current value of the sequence Your_sequence

4, can be used as a calculator select 7*9 from dual;

  

Use of pseudo-table dual in Oracle

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.