473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What is Different Between Empty String and Null value in Oracle?

1
Hi,
Can you Please Tell me What is difference between NULL string and EMPTY string?
Mar 7 '07 #1
1 8199
michaelb
534 Expert 512MB
Going by the SQL standard the difference is very significant:
NULL means no-value
Since NULL is a big void it cannot be really compared to any other value, including an empty string,
About the only way to capture the NULL is to say
Expand|Select|Wrap|Line Numbers
  1. WHERE some_field IS NULL
  2. -- or
  3. WHERE some_field IS NOT NULL
  4.  
Empty string is just that: '' (quote-quote)
For most parts you can treat it just like another character value:
Expand|Select|Wrap|Line Numbers
  1. select * from people WHERE lastname = '' ;
  2. -- or
  3. select * from people WHERE lastname != '' ;
  4.  
Oracle very much blurred the line between NULL and the empty string,
making the latter almost an alias for NULL
The following two statements produce identical results:
Expand|Select|Wrap|Line Numbers
  1. update people set lastname = ''
  2. update people set lastname = NULL
  3.  
which results in something very counter-intuitive:
Expand|Select|Wrap|Line Numbers
  1. UPDATE people set lastname = '' ;
  2. 6 rows updated.
  3.  
  4. SELECT * FROM people where lastname = '' ;
  5. no rows selected
  6.  
  7. SELECT * FROM people where lastname is NULL ;
  8. 6 rows selected
  9.  
There are many articles solely dedicated to the concept of NULL in the databases and people have very opposite opinions on whether we even need them and how they should be treated.
I almost expect that some Oracle experts (I am not the one) will jump in and add some interesting information here.
And I'm sure you'll find tons of it if you just search for "database null" in Google.

Here's one man page on NULLS in Oracle
Mar 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: arvee | last post by:
Hi - I'm updating an Oracle table with an empty string and getting the error: An unhandled exception of type 'System.Exception' occurred in system.data.dll Additional information: Parameter...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
3
by: John Cho | last post by:
/* This program is a database program that will store video tape names, minutes, year released, and price I want it to be professional so that *YOU* will want to buy it and use it for a video...
6
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
3
by: Paul T. Rong | last post by:
Do "" and Null both mean nothing?¡¡ If I don't type anything in text box, the its value is Null£¿¡¡Or it is ¡°¡±£¿ I don¡¯ think they are the same, but I don¡¯t know their difference. Thanks.
8
by: Lyn | last post by:
I am trying to get my head around the concept of default, special or empty values that appear in Access VBA, depending on data type. The Access Help is not much (help), and the manual that I have...
0
by: Ireneus Broncel | last post by:
I have a class which reads Groups and Users from ActiveDirectory. The Problem is, that i have about 10000 rows as product. When I am trying to read the "memberOf" Objects out of this field i get...
16
by: Abhishek | last post by:
why do I see that in most C programs, pointers in functions are accepted as: int func(int i,(void *)p) where p is a pointer or an address which is passed from the place where it is called. what...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.