有数据比较麻烦,可以这样
1. create table temptable as select * from yourtable
2. drop yourtable,create new yourtable with new definition
3. inset into yourtable select * from temptable 
4. drop table temptable 系统提供了DBMS_REDEFINITION包,你可以试试,我还没用过.

解决方案 »

  1.   

    不可以直接改cols中的内容。如果要改的字段有规律(如名字都是CODE开头,长度都改为char(6)),可以根据cols生成脚本来做
    set head off
    set pages 0
    set feed off
    spool 'c:\tmp.sql'
    select 'alter table '||table_name||' modify '||column_name||' char(6);' from cols where column_name like 'CODE%';
    spool off
    @c:\tmp.sql
      

  2.   

    up一下,学习一下,bobfang(匆匆过客)的方法不错
      

  3.   

    谢谢bobfang(匆匆过客),经过你的提示后我可以把char型的全开大就可以了,反正大了也无所谓,小了就不行!select 'alter table '||table_name||' modify '||column_name||' VARCHAR2(255);' from cols where data_type ='VARCHAR2' and table_name LIKE '%DAJ_%';谢谢了,结帖!