【发布时间】:2018-06-19 17:33:44
【问题描述】:
如何在 for 循环中使用动态 sql 语句? 我有一个来自外部循环的变量 i.owner 代表 Schema。
for j in (select * from <schema>.<table>)
loop
begin
null;
exception when others then DBMS_OUTPUT.PUT_LINE('error');
end;
end loop;
游标会导致类似的问题。
【问题讨论】:
-
表名 - 或者至少是表结构,或者您查询的列及其数据类型 - 是固定的,还是每个
i都可能改变? -
这实际上是固定的,我也只需要 1 个 varchar2 列
标签: oracle for-loop dynamic plsql schema