The DUAL table in Oracle database is a technical table with one column named DUMMY (data type VARCHAR2(1)) and one row of data of value 'x' in it. So SELECT * FROM DUAL will give the following result.
DUMMY
-----------
x
The DUAL table is often used to satisfy the SQL syntax that a query must have at least the SELECT and FROM clauses.
For example
SELECT 'My Answer' FROM DUAL;
returns 'My Answer' as the value.
SELECT 'My Answer' || ' Your Answer' FROM DUAL;
returns 'My Answer Your Answer' as the value.
SELECT 1345 FROM DUAL;
returns 1345 as the value.
SELECT 5*20 FROM DUAL;
returns the calculation result (100) as the value. Variance kind of calculations can be performed here.
SELECT SYSDATE FROM DUAL;
returns the current date
SELECT USER FROM DUAL;
returns the user ID that is used to connect to the database.
SELECT <your sequence>.nextval FROM DUAL;
returns the next value from the sequence.
-------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
DUMMY
-----------
x
The DUAL table is often used to satisfy the SQL syntax that a query must have at least the SELECT and FROM clauses.
For example
SELECT 'My Answer' FROM DUAL;
returns 'My Answer' as the value.
SELECT 'My Answer' || ' Your Answer' FROM DUAL;
returns 'My Answer Your Answer' as the value.
SELECT 1345 FROM DUAL;
returns 1345 as the value.
SELECT 5*20 FROM DUAL;
returns the calculation result (100) as the value. Variance kind of calculations can be performed here.
SELECT SYSDATE FROM DUAL;
returns the current date
SELECT USER FROM DUAL;
returns the user ID that is used to connect to the database.
SELECT <your sequence>.nextval FROM DUAL;
returns the next value from the sequence.
-------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
Thanks a bunch Joy.
ReplyDeleteSelena