dual virtual table

Dual is a virtual table used to form the syntax rules of select. Oracle guarantees that there is always only one record in the dual. We can use it to do many things, as follows:

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

  2. To call the system function

  select to_char(sysdate,'yyyy-mm-dd hh24: mi:ss') from dual;--get current system time

  select SYS_CONTEXT('USERENV','TERMINAL') from dual;--get hostname

  select SYS_CONTEXT('USERENV','language') from dual;--get Current locale

  select dbms_random.random from dual;--Get a random number

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

  select your_sequence.nextval from dual;--Get the next value of the sequence your_sequence

  select your_sequence.currval from dual;--Get the current value of the sequence your_sequence

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326372907&siteId=291194637