title: change time function from oracle to postgresql
body: <p>i have got problem with transfer 2 data function from oracle to postgresql can you help me:</p>
  
  <p>Data: </p>
  
  <p>INTERVALL = numeric(10,0)</p>
  
  <p>START_DATE = timestamp without time zone</p>
  
  <p>REPETITIONS = numeric(10,0)</p>
  
  <p>This expression i copy from case state. I must write equivalent logical action in postgresql.</p>
  
  <pre class="lang-sql prettyprint-override"><code> case when (extract(DAY FROM (START_DATE + TRUNC(INTERVALL*(REPETITIONS-1) * 7)))
     - extract(DAY FROM CURRENT_TIMESTAMP)) &gt;= 0 then 'OK'
  </code></pre>
  
  <p>and second:</p>
  
  <pre class="lang-sql prettyprint-override"><code>case when (extract(DAY FROM add_months(START_DATE, TRUNC(INTERVALL*
    REPETITIONS-1) * 12))) - extract(DAY FROM CURRENT_TIMESTAMP)) &lt;= 0 then 'ok'
  </code></pre>