title: Pass time interval via variable in Oracle SQL
body: <p>This query returns the value based on given interval time 10.</p>
  
  <pre><code>SELECT TO_CHAR((TO_DATE('23:20:20','HH24:MI:SS') - INTERVAL '10' MINUTE), 'HH24:MI:SS') 
  FROM DUAL;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>23:10:20
  </code></pre>
  
  <p>I want to pass this minute interval via variable using below code:</p>
  
  <pre><code>declare
  test1 varchar(30);
  begin
  test1:=18;
  SELECT TO_CHAR((TO_DATE('23:20:20','HH24:MI:SS') - INTERVAL ||test1|| MINUTE), 'HH24:MI:SS') 
   FROM DUAL;
   end;
  </code></pre>
  
  <p>But its not working - error is </p>
  
  <blockquote>
    <p>PL/SQL: ORA-00904: "MINUTE": invalid identifier</p>
  </blockquote>
  
  <p>Please assist me on this. Thanks!</p>