title: Oracle 11g hextoraw sql query results
body: <p>So, I have a table called <code>mams_folder</code> , where primary key is <code>mams_folder_id</code>.</p>
  
  <p>Now, its type is raw. I am representing keys in hexadecimal string.
  Following queries were run on sql developer.</p>
  
  <p>Now, I run these queries : </p>
  
  <pre><code>select * from mams_folder f where f.mams_folder_id= hextoraw('EEA12100F39D100384D2080020F03012'); //Works fine
  
  select * from mams_folder f where f.mams_folder_id= 'EEA12100F39D100384D2080020F03012';//Surprisingly works fine too. Why ?
  
  select * from mams_folder f where f.mams_folder_id= hextoraw('5426deaf924642bb9a38dc0b5be87ed6'); //Works fine as expected
  
  select * from mams_folder f where f.mams_folder_id= '5426deaf924642bb9a38dc0b5be87ed6'; //Returns no rows as expected
  </code></pre>
  
  <p>Both are valid primary keys. <code>'5426deaf924642bb9a38dc0b5be87ed6'</code> was newly inserted in database. </p>
  
  <p>Why does db returns answer to second query but returns null for the last ?
  Does it have to do something with db caching ?</p>
  
  <p><strong>Update :</strong> </p>
  
  <p>Ok, I came to know that if I am using primary keys in uppercase hex string, then even without using hextoraw() , queries work fine (as we can see above). However when smaller case is used, hextoraw() becomes compulsary to use else empty result is shown. Why ?</p>