0

This link clear some of the queries about dual table.

But now I am having following doubt is the execution of two queries on dual table:

Query 1

Select * from dual; 

output:

D
-
X

Query2

Select NUll from dual;

output:

D
-

Does Dual contain default value as NULL? If yes why blank is not displayed, as in case of second query.

1
  • the output of your second query is a fake. The actual ouput contains the caption 'N' and not 'D'. – miracle173 Jun 23 '15 at 10:30
0

It's just a display issue.

SQL> select NULL from DUAL;

N
-


SQL>

Using NVL to display NULL instead of a blank:

SQL> select NVL((select NULL from DUAL), 'NULL') from DUAL;

NVL(
----
NULL

SQL> 
2

Phil has an interesting test case. But the dual table has one column and one row with the value x. When you select NULL from dual you are selecting a literal from a table. The literal is not actually in the table. That you can select sysdate from dual does not mean that sysdate is in the dual table either.

SQL> select sysdate from dual;

SYSDATE
---------------
23-MAY-14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.