【发布时间】:2014-10-23 13:51:29
【问题描述】:
我在 PL/SQL Developer 的 SQL 窗口 下创建了一个 .sql 文件。它非常 loooooog,但基本上是在执行以下操作:
TRUNCATE TABLE table_1
REUSE STORAGE;
COMMIT;
INSERT INTO table_1
Select * from table2
Where ...;
COMMIT;
但是,在运行此脚本之前,我们需要确保所有源都已轻松加载。所以我想在这个脚本之前添加一个如下的逻辑来执行检查:
Do check the timestamp field of table1 and table2
If table1.timestamp is NOT today
If table2.timestamp is today then execute the script listed above
Else do nothing
End If
Else do nothing
End If
(Maybe wait for 60 minutes)
Loop
我可以找出 VBA 中的循环,但我更希望有一种方法可以将它添加到现有的 .sql 文件中,或者其他不需要我更改的方法很多现有的 SQL 语言。 不幸的是,我在财务部门工作,不允许在 PL/SQL Developer 中使用任何程序窗口。
有没有人知道有没有办法解决这样的案子??
感谢您的帮助!
【问题讨论】:
-
在 PL/SQL 中检查 LOOP