Oracle数据表字段小写转大写
程序员文章站
2022-06-20 22:48:59
1 BEGIN 2 FOR c IN ( SELECT COLUMN_NAME cn FROM all_tab_columns WHERE table_name = '表名' ) 3 loop 4 BEGIN 5 execute IMMEDIATE 'alter table 表名 rename co ......
1 begin 2 for c in ( select column_name cn from all_tab_columns where table_name = '表名' ) 3 loop 4 begin 5 execute immediate 'alter table 表名 rename column "' || c.cn || '" to ' || c.cn; 6 exception 7 when others then 8 dbms_output.put_line ( '表名' || '.' || c.cn || '已经存在' ); 9 10 end; 11 12 end loop; 13 end;