Oracle treating empty string as NULL problem for a Java / JPA programmer

后端 未结 6 2419
失恋的感觉
失恋的感觉 2021-02-19 17:22

How do you handle this situation where Oracle stores the empty string as a null in the database ?

I would like it to be stored as an empty string as it is not as NULL, s

6条回答
  •  自闭症患者
    2021-02-19 17:57

    It´s not only the selection with special where condition but also the treating of Java String Objects. If you have a String a="" you can call its length method and get 0. If you have a String a=null you get a nullpointer exception when calling length. So working with an oracle db forces you to always check if your string is null before checking length :(

提交回复
热议问题