ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 数据迁移批量变更脚本

数据迁移批量变更脚本

原创 Linux操作系统 作者:golden_zhou 时间:2012-12-14 16:11:40 0 删除 编辑
--批量修改字段数据类型
select 'ALTER TABLE PAYONLINE.'||table_name||' MODIFY('||column_name||' NUMBER(21,4)) ;'
 from dba_tab_columns where wner='PAYONLINE' and data_type='FLOAT'
 
--批量修改约束名
select * from dba_constraints where wner='PAYONLINE' AND constraint_type='P' and constraint_name like '%SYS%'
select 'ALTER TABLE '||table_name||' RENAME CONSTRAINT '||constraint_name||' TO PK_'||table_name||' ;'
 from dba_constraints where wner='PAYONLINE' AND constraint_type='P' and constraint_name like '%SYS%'
 
--批量修改索引名
select 'ALTER INDEX '||index_name||' RENAME TO '||'PK_'||table_name||' ;'
 from dba_constraints where wner='PAYONLINE' AND constraint_type='P' and index_name like '%SYS%'

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25198367/viewspace-751127/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-09

  • 博文量
    238
  • 访问量
    344440