title: Oracle SQL String to Number conversion
body: <p>I have a table where the column type is varchar2, and holds data such as '22:00' or "13:30".
  I'm trying to compare that number to the current time, and if the current time is before that time, select the data.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>select DISTINCT BBT_JOURNEYSTOPS.SERVICE "Service", BBT_JOURNEYSTOPS.STOP_REFERENCE "StopNo", 
    STOP_NAME "Near", BBT_STOPS.ROAD_NAME "On", BBT_JOURNEYSTOPS.JOURNEYTIME "Duration"
  
  from BBT_JOURNEYSTOPS
  inner join BBT_WEEKLYSCHEDULE
  on BBT_WEEKLYSCHEDULE.SERVICE = BBT_JOURNEYSTOPS.SERVICE
  inner join BBT_STOPS
  on BBT_JOURNEYSTOPS.STOP_REFERENCE = BBT_STOPS.STOPREF
  where  (UPPER(BBT_JOURNEYSTOPS.SERVICE) LIKE UPPER('%'|| :route || '%')) AND 
    (TO_NUMBER(SUBSTR(BBT_WEEKLYSCHEDULE.TIMEUNTIL, 1, 2)) &gt; (SELECT TO_NUMBER(SYSDATE, 'HH24') "NOW" FROM DUAL));
  </code></pre>
  
  <p>It's the WHERE statement that is having the issues. The error code I get is</p>
  
  <pre><code>ORA-01481: invalid number format model
  01481. 00000 -  "invalid number format model"
  *Cause:    The user is attempting to either convert a number to a string
             via TO_CHAR or a string to a number via TO_NUMBER and has
             supplied an invalid number format model parameter.
  *Action:   Consult your manual.
  </code></pre>