title: DB2 Query for Hex Values
body: <p>Using DB2 version 10.5. I have a database table which I know has at least one row with bad xml data, which is affecting some other queries I'm trying to do. One of the rows has a #x1A character in it. I'm trying to find a way to do a query that will give me all rows that have invalid xml characters [#x0E-#x1F] in them. Below are several attempts I've tried, but they did not work.</p>
  
  <pre><code>SELECT
    e.EMLNAME
  FROM MYDB.EMPLOYEE e
  WHERE
    -- [#x0E-#x1F]
    /*
    e.EMLNAME like '%#x0E%'
    OR e.EMLNAME like '%#x0F%'
    OR e.EMLNAME like '%#x10%'
    OR e.EMLNAME like '%#x11%'
    OR e.EMLNAME like '%#x12%'
    OR e.EMLNAME like '%#x13%'
    OR e.EMLNAME like '%#x14%'
    OR e.EMLNAME like '%#x15%'
    OR e.EMLNAME like '%#x16%'
    OR e.EMLNAME like '%#x17%'
    OR e.EMLNAME like '%#x18%'
    OR e.EMLNAME like '%#x19%'
    OR e.EMLNAME like '%#x1A%'
    OR e.EMLNAME like '%#x1B%'
    OR e.EMLNAME like '%#x1C%'
    OR e.EMLNAME like '%#x1D%'
    OR e.EMLNAME like '%#x1E%'
    OR e.EMLNAME like '%#x1F%';
  
    e.EMLNAME like '%\x0E%'
    OR e.EMLNAME like '%\x0F%'
    OR e.EMLNAME like '%\x10%'
    OR e.EMLNAME like '%\x11%'
    OR e.EMLNAME like '%\x12%'
    OR e.EMLNAME like '%\x13%'
    OR e.EMLNAME like '%\x14%'
    OR e.EMLNAME like '%\x15%'
    OR e.EMLNAME like '%\x16%'
    OR e.EMLNAME like '%\x17%'
    OR e.EMLNAME like '%\x18%'
    OR e.EMLNAME like '%\x19%'
    OR e.EMLNAME like '%\x1A%'
    OR e.EMLNAME like '%\x1B%'
    OR e.EMLNAME like '%\x1C%'
    OR e.EMLNAME like '%\x1D%'
    OR e.EMLNAME like '%\x1E%'
    OR e.EMLNAME like '%\x1F%';
  
    e.EMLNAME like '%\0x0E%'
    OR e.EMLNAME like '%\0x0F%'
    OR e.EMLNAME like '%\0x10%'
    OR e.EMLNAME like '%\0x11%'
    OR e.EMLNAME like '%\0x12%'
    OR e.EMLNAME like '%\0x13%'
    OR e.EMLNAME like '%\0x14%'
    OR e.EMLNAME like '%\0x15%'
    OR e.EMLNAME like '%\0x16%'
    OR e.EMLNAME like '%\0x17%'
    OR e.EMLNAME like '%\0x18%'
    OR e.EMLNAME like '%\0x19%'
    OR e.EMLNAME like '%\0x1A%'
    OR e.EMLNAME like '%\0x1B%'
    OR e.EMLNAME like '%\0x1C%'
    OR e.EMLNAME like '%\0x1D%'
    OR e.EMLNAME like '%\0x1E%'
    OR e.EMLNAME like '%\0x1F%';
    */
  
    e.EMLNAME like '%0x0E%'
    OR e.EMLNAME like '%0x0F%'
    OR e.EMLNAME like '%0x10%'
    OR e.EMLNAME like '%0x11%'
    OR e.EMLNAME like '%0x12%'
    OR e.EMLNAME like '%0x13%'
    OR e.EMLNAME like '%0x14%'
    OR e.EMLNAME like '%0x15%'
    OR e.EMLNAME like '%0x16%'
    OR e.EMLNAME like '%0x17%'
    OR e.EMLNAME like '%0x18%'
    OR e.EMLNAME like '%0x19%'
    OR e.EMLNAME like '%0x1A%'
    OR e.EMLNAME like '%0x1B%'
    OR e.EMLNAME like '%0x1C%'
    OR e.EMLNAME like '%0x1D%'
    OR e.EMLNAME like '%0x1E%'
    OR e.EMLNAME like '%0x1F%';
  </code></pre>
  
  <p>Any pointers on how I can query for the hex values? I tried to do each hex value individually as I don't know of a way to do a range. If there is a way to do a range, that would be an even better solution.</p>