Questions tagged [null]

Null means *nothing* or *unknown*, depending on context. Please use the "sql-null" tag for SQL specific questions.

"Null" has different meanings depending on context.

Set theory

Null is another name for the empty set, denoted by the symbol ∅. For this reason, some programming languages use null or nil for the empty list or empty tuple. Lisp uses nil to mean the empty list and the boolean value false.

Pointers and References

Null (or sometimes nil or None), in programming languages that support it, is the value of an uninitialized variable, a pointer that doesn't point to a meaningful memory address, or an object that fails to respond to any message.

Nullable references were invented by C.A.R. Hoare in 1965 as part of the Algol W language. Hoare later described his invention as a "billion-dollar mistake".

For more information, see Null pointer.

Agreeing with Hoare's sentiment, many languages don't have a special null value, choosing to use optional types instead.

Relational Databases

NULL as a special marker in SQL or a relational database stands in place of a value that is missing, or in a join means "no corresponding row." The operators IS NULL and IS NOT NULL are required for comparisons to a literal null: other comparisons between NULL and any value evaluate to "unknown."

For more information, see Null (SQL).

ASCII

Null or NUL is the name given to the character with ASCII code zero (0) - i.e. hex 00. In some languages, notably C, NUL is used to mark the end of a character string.

For more information, see Null character.

16208 questions
8
votes
3 answers

SqlBulkCopy into table that Default column values fails when source DataTable row has DBNull.Value

Update: Here is my solution I have a table defined as: CREATE TABLE [dbo].[csvrf_References] ( [Ident] [int] IDENTITY(1,1) NOT NULL, [ReferenceID] [uniqueidentifier] NOT NULL DEFAULT (newsequentialid()), [Type] [nvarchar](255) NOT NULL, …
James Nix
  • 885
  • 1
  • 6
  • 19
8
votes
2 answers

Python ctypes: How to pass NULL as argument with format const char **

I'm trying to initialise Matlab compiler Runtime (MCR) from python using ctypes. My end goal is to be able to use a C DLL created by Matlab compiler in python, but the first hurdle I need to get over is getting MCR up and running. I'm using Python…
ClaireM
  • 91
  • 1
  • 5
8
votes
2 answers

Use cases of Object.create(null)?

If you create a regular javascript object using say var obj = {}; it will have the object prototype. Same goes for objects created using var obj = new MyClass(); Before Object.create was introduced there was no way around this. However nowadays it's…
Wingblade
  • 9,585
  • 10
  • 35
  • 48
8
votes
3 answers

MySQL using BETWEEN comparison with NULL

I have a query with a where condition like so: WHERE A.event_date BETWEEN B.start_date AND B.end_date The complexity is that if B.start_date is NULL, it means from time immemorial, similarly B.end_date is NULL, it means the present. So I still want…
Heisenberg
  • 8,386
  • 12
  • 53
  • 102
8
votes
7 answers

How to assign a value of a property to a var ONLY if the object isn't null

In my code, is there a shorthand that I can use to assign a variable the value of a object's property ONLY if the object isn't null? string username = SomeUserObject.Username; // fails if null I know I can do a check like if(SomeUserObject !=…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
8
votes
5 answers

Wordpress database insert() and update() - using NULL values

Wordpress ships with the wpdb class which handles CRUD operations. The two methods of this class that I'm interested in are the insert() (the C in CRUD) and update() (the U in CRUD). A problem arises when I want to insert a NULL into a mysql…
leepowers
  • 37,828
  • 23
  • 98
  • 129
8
votes
1 answer

Delphi Exception handling problem with multiple Exception handling blocks

I'm using Delphi Pro 6 on Windows XP with FastMM 4.92 and the JEDI JVCL 3.0. Given the code below, I'm having the following problem: only the first exception handling block gets a valid instance of E. The other blocks match properly with the class…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
8
votes
1 answer

May Cassandra maps hold null values

May a Cassandra (CQL 3) map hold null values? I thought null values were permitted, but failure of my program suggests otherwise. Or is there a bug in the driver I am using? The official documentation for CQL maps says: A map is a typed set of…
Raedwald
  • 46,613
  • 43
  • 151
  • 237
8
votes
3 answers

When should I be using "NOT NULL" in a MySQL table and are there any benefits?

I have the following rails migration: create_table :articles do |t| t.integer :user_id, :allow_null => false t.integer :genre_id, :allow_null => false t.string :url, :limit => 255, :allow_null => false t.string :title, :limit => 60,…
Chris Gaunt
  • 773
  • 8
  • 16
8
votes
2 answers

Angularjs and Number.NaN

I was going through the angular docs when I ran into this: https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L1556 Notice that this.$viewValue = Number.NaN; Not just in this doc but in other angular docs as well. What is…
user1460015
  • 1,973
  • 3
  • 27
  • 37
8
votes
2 answers

r - read.csv - skip rows with different number of columns

There are 5 rows at the top of my csv file which serve as information about the file, which I do not need. These information rows have only 2 columns, while the headers, and rows of data (from 6 on-wards) have 8. This appears to be the cause of the…
datavoredan
  • 3,536
  • 9
  • 32
  • 48
8
votes
5 answers

Does dereference a NULL pointer guarantee to crash a program in C/C++?

I come across this wired code and it's not crashing. #include struct s { char* c; char* c2; }; int main() { struct s* p = NULL; printf("%d\n", &(p->c)); printf("%d\n", &p->c2); printf("%d\n", &(*p).c2); return…
ycshao
  • 1,768
  • 4
  • 18
  • 32
8
votes
2 answers

Why is an empty PowerShell pipeline not the same as null?

I am trying to understand the behavior of the @() array constructor, and I came across this very strange test. It seems that the value of an empty pipeline is "not quite" the same as $null, even though it is -eq $null The output of each statement is…
John Rees
  • 1,553
  • 17
  • 24
8
votes
3 answers

GCM returns a null message type

I created an application that uses GoogleCloudMessaging. Application can register to the gcm and store its registration id to the database at my server. I am using php, for sending push notifications but when the google sends it to my device, the…
8
votes
3 answers

Why doesn't calling a static variable chained from a static method that returns null throw a NPE?

I have the following code public class Test { static String mountain = "Everest"; static Test favorite() { System.out.print("Mount "); return null; } public static void main(String[] args) { …
MaheshVarma
  • 2,081
  • 7
  • 35
  • 58