title: Check if a time is between two times in PLSQL
body: <p>I'm trying to check if a time is between two other times in plsql. Solutions anyone?</p>
  
  <pre><code>DECLARE
      vTime   VARCHAR2(10) DEFAULT '18:00:00';
      vFrom   VARCHAR2(10) DEFAULT '17:00:00';
      vUntil  VARCHAR2(10) DEFAULT '09:00:00';
  BEGIN
  
      IF TO_DATE(vTime,'HH24:MI:SS') BETWEEN TO_DATE(vFrom,'HH24:MI:SS') AND TO_DATE(vUntil,'HH24:MI:SS')
      THEN
          DBMS_OUTPUT.PUT_LINE(vTime||' is between '||vFrom||' and '||vUntil);
      ELSE
          DBMS_OUTPUT.PUT_LINE(vTime||' is NOT between '||vFrom||' and '||vUntil);
      END IF;
  
  END;
  </code></pre>
  
  <p>Result:</p>
  
  <p>18:00:00 is NOT between 17:00:00 and 09:00:00</p>