create or replace procedure SP_ChangeOneTabToAnother is
strSql varchar2(200);
begin
dbms_output.put_line('begin');
for c_colName in ( select t.column_name
from ALL_TAB_COLUMNS t
where t.table_name='Table1'
and t.data_type like 'NUMBER%'
and t.owner = 'Owner1')
loop
dbms_output.put_line(c_colName.Column_Name);
strSql:='update owner2.table2 set ' || c_colName.Column_Name||' =0 where '|| c_colName.Column_Name|| ' is null';
dbms_output.put_line(strSql);
execute immediate strSql;
commit;
end loop;
end SP_FACARD_NUMMOD;
/
exec SP_FACARD_NUMMOD;
strSql varchar2(200);
begin
dbms_output.put_line('begin');
for c_colName in ( select t.column_name
from ALL_TAB_COLUMNS t
where t.table_name='Table1'
and t.data_type like 'NUMBER%'
and t.owner = 'Owner1')
loop
dbms_output.put_line(c_colName.Column_Name);
strSql:='update owner2.table2 set ' || c_colName.Column_Name||' =0 where '|| c_colName.Column_Name|| ' is null';
dbms_output.put_line(strSql);
execute immediate strSql;
commit;
end loop;
end SP_FACARD_NUMMOD;
/
exec SP_FACARD_NUMMOD;