Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Dual Table in Oracle

This is a discussion on Dual Table in Oracle within the Oracle forums, part of the Databases category; What does a dual table in oracle do? Where will this table be use at?...

Go Back   Geeks Talk > Databases > Oracle
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-01-2006
Contributing Member
 
Join Date: May 2006
Posts: 66
Thanks: 1
Thanked 6 Times in 4 Posts
janelyn is on a distinguished road
Dual Table in Oracle

What does a dual table in oracle do? Where will this table be use at?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-01-2006
Junior Member
 
Join Date: Apr 2006
Posts: 29
Thanks: 6
Thanked 14 Times in 5 Posts
pat.mclean is on a distinguished road
Re: Dual Table in Oracle

Dual table is like your scratch-pad. you can try different queries & functions using Dual.
For. E.g. if you want to find out max of any numbers that are not present in your schema & you want to do it, you can use dual this way : select max(12,54,2,75,142) from dual;

when you are using some object which doesn't have any phisical reference to your database tables, i.e. it is not resided in any table, you can refer it to dual table. This fulfils the ORACLE's requirement of source table in FROM clause.

Patrick.

Last edited by pat.mclean; 06-01-2006 at 07:47 AM.
Reply With Quote
The Following User Says Thank You to pat.mclean For This Useful Post:
  #3 (permalink)  
Old 06-01-2006
Administrator
 
Join Date: May 2006
Location: New York, USA
Posts: 628
Blog Entries: 8
Thanks: 25
Thanked 1,540 Times in 95 Posts
admin has disabled reputation
Re: Dual Table in Oracle

Quote:
Originally Posted by pat.mclean
Dual table is like your scratch-pad. you can try different queries & functions using Dual.
For. E.g. if you want to find out max of any numbers that are not present in your schema & you want to do it, you can use dual this way : select max(12,54,2,75,142) from dual;

when you are using some object which doesn't have any phisical reference to your database tables, i.e. it is not resided in any table, you can refer it to dual table. This fulfils the ORACLE's requirement of source table in FROM clause.

Patrick.
Very good answer.
Reply With Quote
The Following User Says Thank You to admin For This Useful Post:
  #4 (permalink)  
Old 06-02-2006
Contributing Member
 
Join Date: May 2006
Posts: 66
Thanks: 1
Thanked 6 Times in 4 Posts
janelyn is on a distinguished road
Re: Dual Table in Oracle

Thank you very much! It really was a help in answering my inquiry. Hope you will stay there for my other questions in mind.
Reply With Quote
  #5 (permalink)  
Old 06-22-2006
Contributing Member
 
Join Date: May 2006
Posts: 88
Thanks: 0
Thanked 10 Times in 9 Posts
norman is on a distinguished road
Re: Dual Table in Oracle

Hi,
Dual table has only one row and one column. It is a small table referenced by ORACLE. It is also reference by users to check any results.

Regards,
Norman
Reply With Quote
  #6 (permalink)  
Old 06-22-2006
Expert Member
 
Join Date: May 2006
Location: New York, USA
Posts: 118
Thanks: 0
Thanked 6 Times in 4 Posts
RyanJames is on a distinguished road
Re: Dual Table in Oracle

Hi,
Some more words to add to dual table are the one column which is present in dual table is of type char and of size 1. There are many places in which dual takes its presence. One of the place in which dual is used is sequence values are selected by querying dual.

Regards,
RyanJames
Reply With Quote
  #7 (permalink)  
Old 07-18-2006
Junior Member
 
Join Date: Jul 2006
Location: singapore
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
nagendra09 is on a distinguished road
Re: Dual Table in Oracle

Dual table is a Table created within SYS schema having public synonym this table is created with one cloumn and one row that is very usefull to use oracle Function in plsql without having real table in your schema

E.g If you want to get user name ,sysdate of Server,or etc function you can use this function
Reply With Quote
  #8 (permalink)  
Old 10-05-2008
Junior Member
 
Join Date: Oct 2008
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
a_kumarb is on a distinguished road
Re: Dual Table in Oracle

Quote:
Originally Posted by janelyn View Post
Thank you very much! It really was a help in answering my inquiry. Hope you will stay there for my other questions in mind.
select max(12,54,2,75,142) from dual

it shows the error message invalid identifier

anybody help me....
Reply With Quote
  #9 (permalink)  
Old 10-06-2008
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
Re: Dual Table in Oracle

Quote:
Originally Posted by a_kumarb View Post
select max(12,54,2,75,142) from dual

it shows the error message invalid identifier

anybody help me....
SQL> SELECT greatest(12,54,2,75,142) from dual;

GREATEST(12,54,2,75,142)
------------------------
142


Max function takes only one parameter.

SQL> SELECT max(sal) FROM EMP;

MAX(SAL)
---------
9350

Last edited by krishnaindia2007; 10-06-2008 at 02:19 AM.
Reply With Quote
  #10 (permalink)  
Old 10-06-2008
Junior Member
 
Join Date: Oct 2008
Location: AHMEDABAD
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
sunshine60india is on a distinguished road
Thumbs up Re: Dual Table in Oracle

Dual is small Oracle work table that consist of exactly 1 row and 1 column..

This table is not available in SQL Server...

Ex:

SELECT 2*2 FROM dual;
Reply With Quote
  #11 (permalink)  
Old 10-23-2008
Junior Member
 
Join Date: Sep 2008
Location: bangalore
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
manu4sql is on a distinguished road
Re: Dual Table in Oracle

Quote:
Originally Posted by janelyn View Post
What does a dual table in oracle do? Where will this table be use at?
The DUAL table is called "MAGIC TABLE" in Oracle ....
U can testthing with this DUAL
Ex. select * from DUAL;
O/P : X
Reply With Quote
  #12 (permalink)  
Old 11-03-2008
Expert Member
 
Join Date: Nov 2008
Location: Chennai
Posts: 303
Thanks: 1
Thanked 37 Times in 32 Posts
amitpatel66 is on a distinguished road
Re: Dual Table in Oracle

Dual table is basically used for pseudo columns like my_seq.nextval,curval, level and also to display system date. it contains one row and one column.
Reply With Quote
  #13 (permalink)  
Old 11-04-2008
Junior Member
 
Join Date: Nov 2008
Location: USA, CA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Mad Hatter is on a distinguished road
Re: Dual Table in Oracle

DUAL table useful, for example, to generate sequence of numbers, like this:
SELECT level as ID
FROM DUAL
CONNECT BY level < 101

Will give you seqence of numbers 1..100
Reply With Quote
  #14 (permalink)  
Old 03-12-2009
Junior Member
 
Join Date: Jan 2008
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ram bg is on a distinguished road
Re: Dual Table in Oracle

In your query
"SELECT level as ID
FROM DUAL
CONNECT BY level < 101"

what does 'CONNECT BY' clause do ?
Reply With Quote
  #15 (permalink)  
Old 03-12-2009
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,853
Thanks: 9
Thanked 168 Times in 142 Posts
debasisdas has a spectacular aura aboutdebasisdas has a spectacular aura about
Re: Dual Table in Oracle

the link might be helpful to you.

link
Reply With Quote
  #16 (permalink)  
Old 03-12-2009
Junior Member
 
Join Date: Nov 2008
Location: india
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ibmuser7 is on a distinguished road
Arrow Re: Dual Table in Oracle

dual table is automatically created in oracle with data dictionary ,sys is owner of this dual table.
Reply With Quote
  #17 (permalink)  
Old 03-13-2009
Junior Member
 
Join Date: Jan 2008
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ram bg is on a distinguished road
Re: Dual Table in Oracle

In simple words, can you explain me what does 'connect by' achieve in your query (...... CONNECT BY level < 101) ?
Reply With Quote
  #18 (permalink)  
Old 03-26-2009
Junior Member
 
Join Date: Jan 2008
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ram bg is on a distinguished road
Smile Re: Dual Table in Oracle

Quote:
Originally Posted by sunshine60india View Post
Dual is small Oracle work table that consist of exactly 1 row and 1 column..

This table is not available in SQL Server...

Ex:

SELECT 2*2 FROM dual;

In SQL Server, there exists no 'dual' table. Instead you can query in SQL Server like 'select 2*2' will give you the required output. {PFA the image file 1.jpg} for the output in the SQL Server.


(No Column Name)
------------------
4
Attached Images
File Type: jpg 1.JPG (12.4 KB, 3 views)
Reply With Quote
  #19 (permalink)  
Old 03-26-2009
Junior Member
 
Join Date: Mar 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
aparna.kumbhar is on a distinguished road
Re: Dual Table in Oracle

Dual table is generally used for the completeness of SELECT clause syntax, cause select and from clauses are mandatory but many calculations do not need to select from actual table.
e.g. select 5*9
from dual;
Reply With Quote
  #20 (permalink)  
Old 03-28-2009
Junior Member
 
Join Date: Oct 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
nehrumosuru is on a distinguished road
Re: Dual Table in Oracle

Hi

Try this query

select greatest(10,15,20,30,) from dual

greatest value
-------------
30
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Oracle Interview Questions Free E-Book admin Downloads 308 13 Hours Ago 06:06 AM
Creating a table by copying another table's structure Allan Paul Oracle 19 04-17-2009 06:03 AM
What is Oracle Net Services GeekAdmin Oracle 2 02-15-2007 06:02 AM
Transaction in Oracle Server janelyn Oracle 2 10-13-2006 07:03 PM
Type of Table for Extension Colums RyanJames Oracle Apps 0 05-31-2006 10:58 PM


All times are GMT -4. The time now is 07:34 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved