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

后端 未结 6 2406
失恋的感觉
失恋的感觉 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:38

    try

    create index idx_myfield on mytable(nvl(myfield,-1));
    
    select * from mytable where nvl(myfield,-1)=-1;
    

提交回复
热议问题