给所有表表添加字段的存储过程

来源:互联网 发布:淘宝零食模块怎么写 编辑:程序博客网 时间:2024/06/07 10:10
create or replace procedure pro_sw_sys_uqe_insert_pp is
  begin
      for my_refcur in (
          select table_name
          from all_tables
          where owner='jzb_fxgl' and table_name like 'UQE%'
          and table_name not in
         (select TABLE_NAME
            from user_tab_columns
           where table_name in (select table_name
                                  from all_tables
                                 where owner = 'jzb_fxgl'
                                   and table_name like 'UQE%')
             and column_name = 'S_PP_TIME')
      )
      loop
          execute immediate 'ALTER TABLE '||my_refcur.table_name||' ADD (S_PP_TIME VARCHAR2(200))';
      end loop;
  end
pro_sw_sys_uqe_insert_pp;
0 0
原创粉丝点击