title: SQL string comparison -how to ignore blank spaces
body: <p>I have prepared an SQL query that I will have to run on several databases (Oracle and Sybase) where some data might be stored differently. </p>
  
  <p>I have noticed that one of the differences in data storage is the blank string. 
  For example, in the column <code>PRODUCT_TYPE</code> below, please have a look at the second record: </p>
  
  <p><a href="https://i.stack.imgur.com/Fi75K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fi75K.png" alt="enter image description here"></a></p>
  
  <p>This "empty string" (the data type is <code>CHAR(15)</code>) circled in red is equal to <code>''</code> in some of the databases, whereas it's equal to <code>'    '</code> to some others. The length is never constant and there are several fields that behave as such.</p>
  
  <p>So, since I need to filter on these "empty strings", I should change the following statement in my <code>WHERE</code> clause: </p>
  
  <pre><code>WHERE PRODUCT_TYPE = ''
  </code></pre>
  
  <p>...because the above will take the <code>'     '</code> string as different than <code>''</code> even if "functionally" speaking is not.
  I would hence like to make the statement in a way that it "ignores white spaces", i.e. <code>'  '</code> is equal to <code>''</code> that is equal to <code>'             '</code> etc.
  How should I do this change in order to make it work? </p>
  
  <p>I have tried the simple replacing approach: </p>
  
  <pre><code>WHERE REPLACE(PRODUCT_TYPE,' ','') = ''
  </code></pre>
  
  <p>...but it doesn't seem to work, probably because I should use a different character.
  For sake of testing, inside the <code>'</code> below there is a copied-pasted example of what I find in these "empty strings": </p>
  
  <pre><code>'               '
  </code></pre>
  
  <p>Ideally, it should be a "non-specific SQL" solution since I will have to run the same query on both Oracle and Sybase RDBMS. Any idea? </p>