Role of Oracle dual table

Source: Internet
Author: User
1. To view the current user, run the following statement selectuserfromdual in SQLPlus; 2. Call the system function selectto_char (sysdate,

1. To view the current user, run the following statement select user from dual in SQL Plus; 2. Call the system function select to_char (sysdate,

1. 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 the current system time

Select SYS_CONTEXT ('userenv', 'terminal') from dual; -- get the host name

Select SYS_CONTEXT ('userenv', 'language') from dual; -- get the current locale

Select dbms_random.random from dual; -- obtain a random number

3. Obtain the next or current value of the sequence. Use the following statement.

Select your_sequence.nextval from dual; -- Obtain the next value of the sequence your_sequence

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

4. It can be used as a calculator.

Select 7*9 from dual;

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.