DB2 里有类似 sleep的存储过程,但是得 DB2 v9.7以后版本,而且官方文档也没公开。
下面是会话睡眠暂挂 3秒 的示例
db2 " CALL DBMS_ALERT.SLEEP(3) "
v9.7之前,使用存储过程实现吧,我给您提供个示例:
create procedure test.sleep (in sleeptime integer)
begin
declare wait_until timestamp;
set wait_until = (current timestamp + sleeptime seconds);
while (wait_until > current timestamp)
do
end while;
end