Home » SQL & PL/SQL » SQL & PL/SQL » Datatype for Null
Datatype for Null [message #207124] Mon, 04 December 2006 04:12 Go to next message
inforacle
Messages: 21
Registered: December 2006
Junior Member
What is the datatype for null?
Re: Datatype for Null [message #207127 is a reply to message #207124] Mon, 04 December 2006 04:17 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
All datatypes support a null value.
You can have a null Number, a null Date, a Null Varchar2 etc.
Re: Datatype for Null [message #207128 is a reply to message #207124] Mon, 04 December 2006 04:17 Go to previous messageGo to next message
Ferrarist
Messages: 29
Registered: March 2006
Location: Netherlands - Den Haag
Junior Member
There is no specific datatype for null. Null is a special value. A field or variable of any datatype can hold this specific value (if you did nog specify a NOT NULL constraint that is Razz ).
Re: Datatype for Null [message #207236 is a reply to message #207124] Mon, 04 December 2006 16:36 Go to previous message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
It all depends on how you use it. If you do a CTAS or create a view where one of the columns is defined as NULL, it is created as a varchar2.


>create view test as select null junk from dual;

View created.

>desc test
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 JUNK                                               VARCHAR2


However this can be overridden by using cast or something like

to_date(null)
to_number(null)
Previous Topic: The 2 queries that are supposed to return the same values, return different values:
Next Topic: Oracle Package.Function call from VB.Net?
Goto Forum:
  


Current Time: Wed Dec 07 03:15:53 CST 2016

Total time taken to generate the page: 0.11406 seconds