title: Oracle considers empty strings to be NULL while SQL Server does not - how is this best handled?
body: <p>I have to write a component that re-creates SQL Server tables (structure and data) in an Oracle database.  This component also has to take new data entered into the Oracle database and copy it back into SQL Server.</p>
  
  <p>Translating the data types from SQL Server to Oracle is not a problem.  However, a critical difference between Oracle and SQL Server is causing a major headache.  SQL Server considers a blank string ("") to be different from a <code>NULL</code> value, so a <code>char</code> column can be defined as <code>NOT NULL</code> and yet still include blank strings in the data.</p>
  
  <p>Oracle considers a blank string to be the same as a <code>NULL</code> value, so if a <code>char</code> column is defined as <code>NOT NULL</code>, you cannot insert a blank string.  This is causing my component to break whenever a <code>NOT NULL</code> char column contains a blank string in the original SQL Server data.</p>
  
  <p>So far my solution has been to not use <code>NOT NULL</code> in any of my mirror Oracle table definitions, but I need a more robust solution.  This has to be a code solution, so the answer can't be "use so-and-so's SQL2Oracle product".</p>
  
  <p>How would you solve this problem?</p>
  
  <p>Edit:  here is the only solution I've come up with so far, and it may help to illustrate the problem.  Because Oracle doesn't allow "" in a NOT NULL column, my component could intercept any such value coming from SQL Server and replace it with "@" (just for example).</p>
  
  <p>When I add a new record to my Oracle table, my code has to write "@" if I really want to insert a "", and when my code copies the new row back to SQL Server, it has to intercept the "@" and instead write "".</p>
  
  <p>I'm hoping there's a more elegant way.</p>
  
  <p>Edit 2:  Is it possible that there's a simpler solution, like some setting in Oracle that gets it to treat blank strings the same as all the other major database?  And would this setting also be available in Oracle Lite?</p>