2009-05-28 37 views
2

我在Informix中執行以下操作來刪除超過20秒的行。Informix使用參數定義INTERVAL

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

我討厭informix。 – 2009-05-28 10:47:27

回答

3

,我發現自己的答案。

區間不能用變量動態定義。但你可以使用「單位秒」,所以我的程序變得

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