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