Null has no bounds, it can be used for string, integer, date, etc. fields in a database. Empty string is just regarding a string; it's a string like 'hgjko0p' is, but is just has no length. If you have no value for a field, use null, not an empty string. Null is an absence of a value. An empty string is a value, but is just empty. Null is special to a database. null contains no reference data, so basically it doesn't exist at all. Empty string contains no characters, but is still a reference.
Null is the database's determination of an absense of a value logically. U can query like: where Remarks is NULL.
From the view of Database, for eg let's take Oralce, An empty string is treated as a null value in Oracle. See the below that creates a table called Student :
create table student
( student _id number,
student_name varchar2(100));
Now insert two records into this table...
insert into student (student_id, student_name )
values ( 10565, null );
insert into student (student_id, student_name )
values ( 10567, '' );
The first statement inserts a record with a student_name that is null, while the second statement inserts a record with an empty string as a student_name
Is this help u !
The question is not related to databases at all, but the answer might still help.
You might want to take a look at this:
null : Java Glossary
Experimenting is usually a good way to learn.
wat is the meaning of the abouve if statement?
(name == null) says that no assignment has been made yet.
(name == “”) says that an assignment has been made; its value is “”.
Tom
Just for information only, don’t know if it will help with Java, but, NULL is also used within a batch file. It is actually defined in the OS as a virtual device, I like to think of it as a black hole. Anything written to it is swallowed up and never to be retrieved.
I have used it, in batch files,when a calling a command, which returns a status value/error code to the calling prog, and I have not wanted it to be displayed on screen. It is a pointer to a ‘void’, so the return value/error code gets dropped.
Your ‘emty string(” ” )’ actually isn’t empty, it contains a space (chr$32) and empty string is indicated by “” (no space between the quotes.) so if you are having problems with empty strings, this may be the reason.
I am not conversant with java, but in C, C++, VB (and many other high level languages,) it is an indication that the variable hasn’t been used, (but it has been declared, and a pointer has been allocated for any value it recieves) or, it has been emptied, so it can be re-used as a clean container.