I have got one field column called ‘id‘ in the Oracle database, the value of ‘id’ can be null or 2-space(i.e. ” “) string. That field value is mapped by a third party application (Serena Business Manager). I am supposed to write a javascript to tell whether the field is null or with 2 spaces.
I tried so by the javascript statement:
if(id === '')
{
doSomething()
}
This will allow those ‘id’s with a null value in the database pass. So here is the question: how to let string with spaces(not necessarily two) in the database pass a javascript ‘if’ statement?
In Oracle, there is no difference between a NULL and an empty string. The empty string is NULL. You can’t differentiate between the two in code because you can’t differentiate between them in the database.
There is another thread on StackOverflow where we discuss why Oracle treats the empty string as NULL despite the fact that the ANSI standard specifies that the two should be treated differently.
Since it sounds like you’re actually not looking for empty strings but for strings with two spaces