Oracle sql: using bind variable for dates..

Posted by user333747 on Stack Overflow See other posts from Stack Overflow or by user333747
Published on 2010-05-13T18:50:47Z Indexed on 2010/05/13 18:54 UTC
Read the original article Hit count: 748

Filed under:
|

Here is a simple working query without bind variables:

select * from table1 where time_stamp > sysdate - INTERVAL '1' day;

where time_stamp is of type DATE.

I should be able to input any number of days in the above query using bind variable.

So I tried the following and does not seem to work:

select * from table1 where time_stamp > sysdate - INTERVAL :days day;

I tried entering the numeric input both as 10 and '10',for eg. You get ORA-00933 error on 10g.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about sql