How to use bind variables in date interval functions
I am trying to write an sql, that takes two inputs at run time, if I am passing null then it looks at a database table and gets values from it. To make the NULL checks and then assign values from database, I implemented the logic as its given here https://asktom.oracle.com/pls/apex/f?p=100:11:::NO:RP:P11_QUESTION_ID:9531682100346333508 But I am not able to use the bind variables in the Date and Interval feilds. Here is a shorter version of the code <code> var v_interval varchar2(5) var v_time varchar2(30) / exec :v_interval := '1' exec :v_time := to_char(systimestamp,'DD-MON-YY HH24:MI:SS:FF') select :v_time,:v_interval from dual / select systimestamp + interval '1' hour from dual / select systimestamp + interval :v_interval hour from dual / exit </code> The error I get is <code> select systimestamp + interval :v_interval hour from dual * ERROR at line 1: ORA-00923: FROM keyword not found where expected </code> Can we use bind variable here, or is it totally wrong? Thanks a lot for your help. --Vivek
How to use bind variables in date interval functions