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

How can I prevent a string argument changing from null to empty when bound to a parameter?

Consider the following code: function f { param ( [AllowNull()] [string] $x ) return $x } $r = f -x $null $null is converted to [string]::Empty by the time return is reached. $null is different from…
alx9r
  • 3,675
  • 4
  • 26
  • 55
8
votes
2 answers

Remove | null from Typescript type

I just started learning TypeScript and in some cases I'm getting an that could be Type or null. Is there an elegant way to deal with these cases? function useHTMLElement(item: HTMLElement) { console.log("it worked!") } let myCanvas =…
Ben
  • 5,952
  • 4
  • 33
  • 44
8
votes
2 answers

PHP/mySQL INSERT NULL if variable is empty

i want to check if a variable from $_POST is empty and INSERT a NULL to my Database. But when I do it my way i always get a String called NULL and not a real NULL in my data set. This is how I tried it: if(isset($_POST['folge'])){ $comment =…
pfmd86
  • 81
  • 1
  • 1
  • 5
8
votes
3 answers

How to deal with Spark UDF input/output of primitive nullable type

The issues: 1) Spark doesn't call UDF if input is column of primitive type that contains null: inputDF.show() +-----+ | x | +-----+ | null| | 1.0| +-----+ inputDF .withColumn("y", udf { (x: Double) => 2.0 }.apply($"x") // will not be…
Artur Rashitov
  • 474
  • 4
  • 12
8
votes
1 answer

JavaFX: Storing null in a SimpleIntegerProperty

I have a SimpleIntegerProperty which should be able to store null. However, this is not possible, as written in the JavaDoc of IntegerProperty: Note: setting or binding this property to a null value will set the property to "0.0". See…
user7291698
  • 1,972
  • 2
  • 15
  • 30
8
votes
3 answers

Xamarin Form Error Value cannot be null. Parameter name: type

All day I was receiving this very clear (not the sarcasm) error message "Value cannot be null. Parameter name: type" I was hitting my head against the wall slowly decomposing my code until I could figure out the exact cause of the problem. After…
George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52
8
votes
2 answers

Neo4j use MERGE with null values

I know this question has been asked several times before but the answers didn't solve my problem. I am trying to execute this query: USING PERIODIC COMMIT LOAD CSV WITH HEADERS…
Porjaz
  • 771
  • 1
  • 8
  • 28
8
votes
8 answers

NULL vs Empty when dealing with user input

Yes, another NULL vs empty string question. I agree with the idea that NULL means not set, while empty string means "a value that is empty". Here's my problem: If the default value for a column is NULL, how do I allow the user to enter that…
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
8
votes
3 answers

SQLite3: Insert BLOB with NULL characters in C++

I'm working on the development of a C++ API which uses custom-designed plugins to interface with different database engines using their APIs and specific SQL syntax. Currently, I'm attempting to find a way of inserting BLOBs, but since NULL is…
jbatista
  • 2,747
  • 8
  • 30
  • 48
8
votes
3 answers

DAO with Null Object Pattern

After Reading: Effective Java (See Item 43) - Joshua Bloch Clean Code (Don't Return Null) - Uncle Bob Avoiding != null statements Null Object pattern I was looking for an answer to the question of what a DAO should return when a search ends up…
Ye Win
  • 2,020
  • 14
  • 21
8
votes
2 answers

c# Object obj's value is {}. What is "{}"?

I'm using some old code that runs a sql query as a reference. At some point, it gets to something like: sqlDataAdapter.Fill(dataSet); DataRow dataRow = dataSet.Tables[0].Rows[0]; Object obj = dataRow[fieldName]; The old code does: string output; if…
Kache
  • 15,647
  • 12
  • 51
  • 79
8
votes
8 answers

JavaScript convert NULL to 0

I'm using jQuery to get the height of an element. But if the element doesn't exist, the following code will return NULL: $height = $('#menu li.active ul').height(); // returns integer or null Is it a cross-browser safe way for getting an integer…
pbaldauf
  • 1,671
  • 2
  • 23
  • 32
8
votes
4 answers

Oracle - Table alias and NULL evaluation in join

I was just trying to make an example to explain how NULL in Oracle can lead to 'unexpected' behaviours, but I've found something I did not expect... setup: create table tabNull (val varchar2(10), descr varchar2(100)); insert into tabNull values…
Aleksej
  • 22,443
  • 5
  • 33
  • 38
8
votes
1 answer

How can I store a NULL ASCII character (nul) in a variable with a Windows batch script?

Following the post How can I write a null ASCII character (nul) to a file with a Windows batch script? there are indeed methods to write an ASCII NULL character (nul) to a file with a batch script. However, I cannot find a way to store a NULL…
aschipfl
  • 33,626
  • 12
  • 54
  • 99
8
votes
1 answer

How can we define null as a datatype in Android, like we define nsNull in iPhone

jsonObject.accumulate("status",null); I want to pass null as a value in json service call i try ""," ", NULL, nil,"null" but nothing helps Could anyone have solution for this ?