Geeks Talk

Prepare for your Next Interview




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 FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-01-2006
Contributing Member
 
Join Date: May 2006
Posts: 66
Thanks: 1
Thanked 5 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 12 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: 562
Thanks: 20
Thanked 1,311 Times in 77 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 5 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: 754
Thanks: 22
Thanked 64 Times in 63 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 4 Weeks Ago
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 2 Weeks Ago
Contributing Member
 
Join Date: Nov 2008
Location: Chennai
Posts: 66
Thanks: 0
Thanked 5 Times in 5 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 2 Weeks Ago
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
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Oracle Interview Questions Free E-Book admin Downloads 277 1 Week Ago 02:16 AM
Creating a table by copying another table's structure Allan Paul Oracle 12 07-12-2007 07:53 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 05:14 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved