I am doing the following in Informix to delete rows more than 20 seconds old.
delete from sometable
where someDateColumn < (current - interval (20) second to second);
However, I want to make the interval configurable in a stored procedure, but I can’t do
CREATE PROCEDURE i_hate_informix (prm_timeframe int)
DELETE sometable
WHERE someDateColumn < (current - interval (prm_timeframe) second to second);
END PROCEDURE;
I found the answer myself.
Interval can not be defined dynamically with a variable. But you can use “units second” so my procedure becomes