Can you explain what is DUAL table in oracle ?

Questions by Sundra

Showing Answers 1 - 8 of 8 Answers

Smrati Saxena

  • Apr 3rd, 2006
 

Hi

Dual is a virtual table ...it do not eists .

It is used to query fro pseudo columns..

eg;

select sysdate from dual

pramod kumar

  • Apr 6th, 2006
 

Dummy table with one row and one column, we can select from it but cant insert update delete.

  Was this answer useful?  Yes

dhk

  • Apr 20th, 2006
 

Hello Friends

                Dual is a dummy table which has one row and one column .

  Was this answer useful?  Yes

Renuka Rajput

  • Aug 2nd, 2006
 

Dual is oracle created table.It is called as dummy table n it has one row and one cloumn.

  Was this answer useful?  Yes

lieni

  • Jul 30th, 2007
 

Sorry dual is not a dummy table. Dual really exists and also that it has exactly one row and one column isn't correct.

You can insert:

Insert into dual value 'Y'

Select sysdate from dual will then return two lines with the actual timestamp.

shina

  • Sep 18th, 2007
 

Yes you are right that DUAL table has multiple cols but only one row.
But the insert statement that you've mentioned is not working.

  Was this answer useful?  Yes

kishore

  • Oct 6th, 2007
 

Dual table is one which is having only one row & one coulmn and it is maintained by Oracle server. Which is used for mathamatical calculations like sqrt, round, power, max, min etc.

  Was this answer useful?  Yes

DUAL IS A DUMMY TABLE. WE CAN INSERT,UPDATE AND DELETE FROM DUAL TABLE IF YOU LOG IN WITH SYSTEM/MANGER PRIVILLAGES.

EXAMPLE:

SELECT * FROM DUAL;
no rows selected


DESC DUAL
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DUMMY                                              VARCHAR2(1)


SQL> INSERT INTO DUAL VALUES('Y');

1 row created.


SQL> SELECT * FROM DUAL;

D
-
Y


SQL> UPDATE DUAL SET DUMMY='S';

1 row updated.

SQL> SELECT * FROM DUAL;

D
-
S


SQL> DELETE FROM DUAL;

1 row deleted.

SQL> SELECT * FROM DUAL;

no rows selected


EVEN IF U INSERT A ROW INTO DUAL TABLE STILL IT CAN BE USED TO RETRIEVE DATA FOR PSUEDO COLUMNS.

YOU CAN INSERT ONLY ONE RECORD INTO THE DUAL TABLE, IF U TRY TO INSERT ANOTHER RECORD IT WILL NOT GIVE ANY ERROR,IT WILL JUST DISPLAY 1 ROW INSERTED BUT U WILL FIND ONLY 1 ROW. ie THE PREVIOUS RECORD.


REGARDS
SHARAT

most of our friends have given different answers for this..........infact most of them are same and correct .......but I will give one simple definition and small logic beyond its working.........?
 I can say it is a practise table as it contains only one column and one row...that is its column name is dummy and value is x...even though if try to insert any value also it will take,but will not be updated into the actual table.....

even we can create this type of table for ur own purpose......

second point which i have mentioned is:

we normally use this table for functions by using select stmt................
for example:
let us type this.

select sysdate from dual;
here the select statement works for every row in a table and its basic use is it will always try to retrive a value for the expression or column or function for which we have given in select statement and it works for each record..........

so normally it contains one row, so you will be displayed with one value that's if u  can see we cannot test group functions with dual table..

if you have any doubts regarding functionality of dual table:

let try to write this query...

select sysdate from emp

this will try to display sysdate for the number of rows that is present in emp table......

so dual table creation is different and don't try to think of inserting any rows in it,because it won't take any as this is used for simple processing of select statement....



nare4u

  • Nov 15th, 2008
 

SQL> select 2 from dual;

         2
----------
         2

SQL> select 2,3 from dual;

         2          3
---------- ----------
         2          3

  Was this answer useful?  Yes

meenatchim

  • Nov 16th, 2008
 

DUAL is a table.That is owned by SYS  user .It has a  column name as dummy and it containts a row having a vale "X".The dual table is useful when u want to retun a value once only,the value that is not derived in from a table with userdata

  Was this answer useful?  Yes

deepak

  • Feb 24th, 2009
 

Dual is a system defined table having one rows and one column. A person who has informed that it has virtual
existence is not proper. It has physical existence.
Ex:
SQL> select * from dual;

D
-
X
Means a table having single row and columns.

Regards,
Deepak Mahapatra
TCS Bangalore

  Was this answer useful?  Yes

sk45453

  • Aug 23rd, 2010
 

Dual is a table which is created by oracle along with the data dictionary. It
consists of exactly one column whose name is dummy and one record. The value of
that record is X. The owner of dual is SYS but dual can be accessed by every
user. As dual contains exactly one row (unless someone fiddled with it), it is
guaranteed to return exactly one row in select statements. Therefore, dual is
the preferred table to select a pseudo column (such as sysdate). Although it is
possible to delete the one record, or insert additional records, one really
should not do that!


subrahmanyam pattapu

  • Jul 19th, 2011
 

Dual is default table in oracle .it contains single row and single column.All the Character functions and number functions and date functions execution done in this Dual table.

  Was this answer useful?  Yes

shadiq

  • Jun 25th, 2015
 

Insert into dual values (Y); will work i guess, only thing is you need a sufficient privilege...
Also Dual can have 1000 columns and only one row.

Dnyaneshwar Mane

  • Apr 25th, 2018
 

DUAL is a special one-row and 1-column table having value "X" by default in Oracles SYS schema.
This table can be used for the purpose of :
1. Calculating mathematical expressions like:
SELECT 1 + 1 AS "SUMMATION", SYSDATE + 1 AS "NEXTDAY" FROM DUAL;
2. Selecting pseudo columns like :
SELECT SYSDATE, USER FROM DUAL;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions