News for hackers. Stuff that matters.
Re:Problems with Oracle SQL by 5e92cb50239222b on Friday September 10, 2021 @12:50PM (#28484149)
So how do you insert an empty string into a NOT NULL column? Please don't tell me that it's not possible.
Re:Problems with Oracle SQL by postalrat on Friday September 10, 2021 @12:57PM (#28484272)
First you accept that null and an empty string are the same thing. Then you insert a null.
Re:Problems with Oracle SQL by adamzochowski on Friday September 10, 2021 @02:54PM (#28485666)
But they are not. Empty string means "we know this is empty", Null means "We don't know".

For example, I have a second name. Some people don't have second names. And some records we might not even know if such exists. Null means "unknown". Empty string cannot be equal to null.

Re:Problems with Oracle SQL by spywaregorilla on Friday September 10, 2021 @03:02PM (#28485740)
Somebody hasn't learned how to love big brother yet.
Re:Problems with Oracle SQL by Brian_K_White on Friday September 10, 2021 @03:45PM (#28486134)
It's like how at one time, "0" was not yet invented and had to be invented and explained, and it was a revolution for math. It's a quantity just like 5 or 244, but for when the amount happens to be none.

We need that again, another new 0 concept to add to 0, to distinguish between "set-to-0" and "not-yet-set".

Maybe 2 new concepts, since null is also different from 0. 0 is a value, null is the absense of a value.

Not just as an idiom or implementation detail in a programming language, but as a general concept that may be used anywhere in life.

Without it, we have exactly these confusions and ambiguities and differences of opinion about how to do something or what something means or what something should mean.

Re:Problems with Oracle SQL by tux3 on Friday September 10, 2021 @03:19PM (#28485910)
Bad software punishes you for doing things right.
Re:Problems with Oracle SQL by gmfawcett on Friday September 10, 2021 @01:10PM (#28484450)
Either make the column nullable, or apply local workarounds and folklore. E.g. I've seen "person" records with surname = '.' in certain databases, for people who don't have one.
Re:Problems with Oracle SQL by myohmy on Friday September 10, 2021 @01:40PM (#28484823)
Honestly that's bad db design anyways. If empty string is a valid value then you don't want NOT NULL anyways. This is a table structure constraint, not a variable declaration. NOT EMPTY would have been a better syntax imo but that's a whole can of worms.
Re:Problems with Oracle SQL by MrStonedOne on Friday September 10, 2021 @03:17PM (#28485888)
Empty string means "we know its blank" null means "we don't know".

When it comes to datatyping, (the whole point of data types in a db), null is its own datatype, so forcing the allowance of nulls to get blank strings is kinda stupid and only causes software/application level bugs.

Re:Problems with Oracle SQL by jhgb on Friday September 10, 2021 @04:27PM (#28486508)
An empty string is a perfectly valid neutral element of the free monoid over the alphabet in question. It's also not a NULL value for this reason. If a NOT NULL column of strings allows for all strings except for a very important one, then that's a very weirdly special-cased design of the RDBMS.
Re:Problems with Oracle SQL by jhgb on Friday September 10, 2021 @01:02PM (#28484351)
Obviously you prefix every string with a space and when reading, strip the leading space. Then " " is your empty string. ;)

For real though, no idea. I'm glad that I never had to touch Oracle.

Re:Problems with Oracle SQL by zzzeek on Friday September 10, 2021 @12:52PM (#28484188)
its...

....

sorry

not possible (can't store empty string in a NULL col either)

for reals

Re:Problems with Oracle SQL by robertlagrant on Friday September 10, 2021 @02:20PM (#28485293)
Just store the string "empty" and hope there are no nihilists who've changed their names to match. Simple!
Re:Problems with Oracle SQL by munk-a on Friday September 10, 2021 @04:16PM (#28486410)
Real programmers encode emptiness as ZZZ...

(I once worked maintaining a MUD that used internal memory management and marked block terminals (which were unnecessary since it stored the length of blocks it had allocated) with ZZZ)

Re:Problems with Oracle SQL by robertlagrant on Sunday September 19, 2021 @01:39PM (#28586243)
ZZZ? EEK!
Re:Problems with Oracle SQL by tracker1 on Friday September 10, 2021 @02:59PM (#28485714)
Use vertical tab, or another whitespace or field separator character, like EOF etc. Generally something a modern keyboard won't be entering, and won't generally be transmitted over the wire.
Re:Problems with Oracle SQL by jhgb on Friday September 10, 2021 @07:23PM (#28487970)
Or just prefix everything so that your string domain doesn't shrink? Then you don't have to worry what your users enter.