Q
Problem solve Get help with specific problems with your technologies, process and projects.

What values can be deduced from sys.dual?

What other values can be deduced from sys.dual? I know of sysdate and user...

The DUAL table is a simple "dummy" table you can use to derive anything you wish when you only need to return a single row answer and don't need to retrieve any real table data.

SQL> desc sys.dual 
 Name                                      Null?    Type
 ----------------------------------------- -------- -----------------
 DUMMY                                              VARCHAR2(1)
 
SQL> select sysdate, user, 1+3, sysdate + 100 from dual ;
 
SYSDATE   USER                                  1+3 SYSDATE+1
--------- ------------------------------ ---------- ---------
14-FEB-03 KAREN                                   4 25-MAY-03
You can use it to call a function you write, for example:
SQL> select get_custname(100) as custname from dual ;

CUSTNAME
------------------------------
ACME Inventory Company
You can also use it to call a built-in function like TO_CHAR, for example:
SQL> select TO_CHAR(TO_DATE(?01-01-1997?, ?MM-DD-YYYY?),?J?) from dual ;

TO_CHAR
--------
2450450
So... the answer is that you can use DUAL to answer almost any question you want!

For More Information


This was last published in February 2003

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close