DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Dual table

  1. #1
    Join Date
    Jul 2001
    Posts
    52

    Question Dual table

    hi all,
    well m preparing for oca(sql). i found some strange result in dual table. so i would b very thankful if any one can explain me !!


    SQL> connect scott/tiger as sysdba
    Connected.
    SQL> select * from dual;
    D
    -
    X

    SQL> insert into dual
    2 values('y');
    1 row created.

    SQL> select count(*) from dual;

    COUNT(*)
    ----------
    3

    Questions :

    1) As dual is sys table y it allows me to insert row into it ?? and if i can insert row into it...y it doesn't show me even thogh it and gave me msg that '1 row created.'

    2) why it has datatype only varchar2 and not number ??


    waiting 4 ur reply
    thanks
    rakesh
    Don't say you're not important,
    It simply isn't true,
    The fact that you were born,
    Is proof, God has a plan for you.

    Rakesh Sanghvi

  2. #2
    Join Date
    Oct 2001
    Location
    Toronto, Canada
    Posts
    236
    What user ID did you use to login? Regular user should not be able to update this table. Why are you saying it does not show new rows? There are 2 more rows in dual than there shoudl be.
    Leo
    Oracle 8i OCP DBA
    Toronto, Canada

  3. #3
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    DUAL is a special table, and the optimizer uses particular optimizations for it.

    Never modify the DUAL table.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  4. #4
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    connect scott/tiger as sysdba

    causes to allow more rows in dual table.

    Tamil

  5. #5
    Join Date
    Jul 2001
    Posts
    52
    hi all,

    Thanks for the reply.

    well leo...while using count(*), it shows me three records but when u use select * from dual, it will show u only one record the value (x) which is by default there...

    so my question is y is shows three records ??

    thanks
    rakesh

  6. #6
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Quote Originally Posted by rakesh76
    well leo...while using count(*), it shows me three records but when u use select * from dual, it will show u only one record the value (x) which is by default there...

    so my question is y is shows three records ??
    Like I said before, "DUAL is a special table, and the optimizer uses particular optimizations for it.". The optimizer "knows" what the result of "SELECT * FROM DUAL" is, because there is only one row in the DUAL table. A similar optimization does not apply to to "SELECT COUNT(*) FROM DUAL".
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  7. #7
    Join Date
    Jul 2001
    Posts
    52
    thanks slimdave for the reply.

  8. #8
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Is DUAL a special table or something?
    Jeff Hunter

  9. #9
    Join Date
    Aug 2006
    Posts
    5
    Yes it is.

    Can be very usefull in certain circumstances.
    What if you just wanted to calculate a bunch of numbers, for example 10*10?
    I know this is a very simple example, but you would use the dual table like this;

    select 10*10 from dual;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width