Informix defining an INTERVAL with a parameter

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;

Answer1:

I found the answer myself.

Interval can not be defined dynamically with a variable. But you can use "units second" so my procedure becomes

CREATE PROCEDURE i_hate_informix (prm_timeframe int) DELETE sometable WHERE someDateColumn < (current - prm_timeframe units second); END PROCEDURE;

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:Informix defining an INTERVAL with a parameter