title: Oracle treating empty string as NULL problem for a Java / JPA programmer
body: <p>How do you handle this situation where Oracle stores the empty string as a null in the database ?</p>
  
  <p>I would like it to be stored as an empty string as it is not as NULL, since issuing the query would be easier.</p>
  
  <p>Something like this would select the empty string and non-empty string, but not the null values</p>
  
  <pre><code>select * from mytable where myfield like '%';
  </code></pre>
  
  <p>if i would like to select also the null values (which should be originally empty string), i would have to select like this :</p>
  
  <pre><code>select * from mytable where myfield like '%' or myfield is null;
  </code></pre>
  
  <p>i would love to skip doing <code>or myfield is null</code> all the time later in my sql statements</p>
  
  <p>The current solution i have in mind is to take care of this in the application level,
  for example, in the entity, i initialize all my String field default value to a space, for example :</p>
  
  <pre><code>@Entity
  public class MyEntity {
    private String name = " ";
  
    public void setName(String name) {
      if (isEmptyString(name)) {
        name = " ";
      }
    }
    ...
  
  }
  </code></pre>
  
  <p>Or perhaps, i can make use of a new type still unknown to me from Oracle 11g that can keep empty string as it is without changing it to null value ?</p>
  
  <p>Thank you !</p>