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

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;

你可能感兴趣的:(给所有表表添加字段的存储过程)