Informix使用参数定义INTERVAL

时间:2009-05-28 10:37:10

标签: informix

我在Informix中执行以下操作以删除超过20秒的行。

delete from sometable
where someDateColumn < (current - interval (20) second to second);

但是,我想在存储过程中配置间隔,但我不能

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

1 个答案:

答案 0 :(得分:3)

我自己找到了答案。

无法使用变量动态定义间隔。但你可以使用“单位秒”,所以我的程序变成

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