我需要实现一个用 PL/SQL 编写的心跳函数,每 5 分钟 ping 一次 Web 服务。我知道 PL/SQL 确实不是编写此代码的正确语言,但必须以这种方式完成。
DECLARE
stored_time TIMESTAMP
curr_time TIMESTAMP
BEGIN
stored_time := current_timestamp;
WHILE (curr_time - stored_time > 5)
pulse_heartbeat();
stored_time := current_timestamp;
END WHILE
上面的伪代码确实是我认为可以完成的唯一方法。我知道有一个带有 oracle 的计时器包,但我不确定我是否应该使用它。有任何想法吗?