create or replace procedure droptable_sp as
begin
for c in (select table_name from user_tables where table_name like 'T\_TIG\_DFL00J___Y____M__') loop
if (trunc(sysdate,'mm')-to_date(substr(c.table_name,17,4)||
substr(c.table_name,23,2),'yyyymm')) year to month > interval '12' month then
execute immediate 'drop table '||c.table_name;
end if;
end loop;
end;
这段代码中 for c in 这个c是干什么的?
这个应该用到了绑定变量,减少硬解析?请问什么时候用呢?我现在是看的明白不知道怎么用~~
begin
for c in (select table_name from user_tables where table_name like 'T\_TIG\_DFL00J___Y____M__') loop
if (trunc(sysdate,'mm')-to_date(substr(c.table_name,17,4)||
substr(c.table_name,23,2),'yyyymm')) year to month > interval '12' month then
execute immediate 'drop table '||c.table_name;
end if;
end loop;
end;
这段代码中 for c in 这个c是干什么的?
这个应该用到了绑定变量,减少硬解析?请问什么时候用呢?我现在是看的明白不知道怎么用~~
这段代码号熟悉啊