Informix 使用参数定义 INTERVAL

发布于 2024-07-23 05:08:47 字数 395 浏览 6 评论 0原文

我正在 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;

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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奶气 2024-07-30 05:08:47

我自己找到了答案。

不能使用变量动态定义间隔。 但是你可以使用“单位秒”,这样我的程序就变成了

CREATE PROCEDURE i_hate_informix (prm_timeframe int)
   DELETE   sometable
   WHERE    someDateColumn < (current - prm_timeframe units 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

CREATE PROCEDURE i_hate_informix (prm_timeframe int)
   DELETE   sometable
   WHERE    someDateColumn < (current - prm_timeframe units second);
END PROCEDURE;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文