title: Oracle 10g simple query error
body: <p>Oracle SQL Developer complains about next SQL though I can't seem to find the reason:</p>
  
  <pre><code>IF to_number(to_char(sysdate, 'HH24')) &gt; 6 THEN
    IF to_number(to_char(sysdate, 'HH24')) &lt; 9 THEN
      SELECT 1 FROM dual;
    ELSE
      SELECT (CASE WHEN result = 'SUCCESS' THEN 1 ELSE 0 END) FROM t_job WHERE to_char(start_time, 'yyyy/mm/dd') = to_char(sysdate, 'yyyy/mm/dd');
    END IF;
  ELSE
      SELECT (CASE WHEN result = 'SUCCESS' THEN 1 ELSE 0 END) FROM t_job WHERE to_char(start_time, 'yyyy/mm/dd') = to_char(sysdate, 'yyyy/mm/dd');
  END IF;
  </code></pre>
  
  <p>What's the mistake in provided query?</p>
  
  <p>Error report:</p>
  
  <pre><code>Error starting at line 7 in command:
  ELSE
  Error report:
  Unknown Command
  (CASEWHENRESULT='SUCCESS'THEN1ELSE0END) 
  --------------------------------------- 
  1                                       
  
  
  Error starting at line 9 in command:
  END IF
  Error report:
  Unknown Command
  </code></pre>