title: Oracle query for time difference in seconds
body: <p>I am looking for a query to find the gap between two time fields. </p>
  
  <p>Table <code>A</code> and table <code>B</code> in both <code>COL3</code> contain time value. <code>8:13:54</code>.  <code>COL3</code> Is a Char field.</p>
  
  <p>Table <code>B</code> also having same fields.  I Want to query on the following conditions.</p>
  
  <pre><code>A.COL1 = B.COL1 and 
  A.COL2 = B.COL2 and 
  (COL3 in a should equal to + / - 120 secs of COL B).
  </code></pre>
  
  <p>I tried  to use <code>TO_DATE</code>, but its not working out.  How can i achieve this?</p>
  
  <p>This works for me. Thanks.</p>
  
  <p>SELECT A.<em>, B.</em>
  FROM A, B
  WHERE A.COL1 = B.COL1
  AND A.COL2 = B.COL2
  AND ( TO_DATE(B.COL3,'hh:mi:ss') = (TO_DATE(B.COL3,'hh:mi:ss') + (120/(24*60*60)))
        OR TO_DATE(B.COL3,'hh:mi:ss') = (TO_DATE(B.COL3,'hh:mi:ss') - (120/(24*60*60))) )</p>