Oracle跨ower操作

来源:互联网 发布:淘宝推广一年多少钱 编辑:程序博客网 时间:2024/06/05 06:32
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;  
原创粉丝点击