Oracle中复制注释到新表中去

declare
  v_comment varchar2(100);
  v_stmt varchar2(4000);
  v_orig_table varchar2(100) :=‘ORIGINAL_TABLE‘;
  v_new_table varchar2(100) :=‘MYTABLE‘;
begin
  for c in (select column_name
              from user_tab_columns c
             where table_name=v_orig_table
               and exists(select 1 
                            from user_tab_columns
                            where table_name=v_new_table
                              and column_name=c.column_name)) loop
    select comments 
    into v_comment
    from user_col_comments 
    where table_name= v_orig_table
    and column_name=c.column_name;

    v_stmt:=‘comment on column ‘||v_new_table||‘.‘||c.column_name||‘ IS ‘‘‘||v_comment||‘‘‘‘;

    execute  immediate v_stmt;
  end loop;

end;

Oracle中复制注释到新表中去

上一篇:oracle差异增量异地备份(Differential incremental and remote backup)


下一篇:Oracle 数据库操作相关脚本