查询脚本,实现oracle数据库表及字段名全部设置为大写
2015-06-03 13:16
211 查看
begin
for t in (select table_name tn from user_tables where table_name <> upper(table_name)) loop
begin
for c in (select column_name cn from user_tab_columns where table_name=t.tn) loop
begin
execute immediate 'alter table "'||t.tn||'" rename column "'||c.cn||'" to '||c.cn;
exception
when others then
dbms_output.put_line(t.tn||'.'||c.cn||'已经存在');
end;
end loop;
execute immediate 'alter table "'||t.tn||'" rename to '||t.tn;
exception
when others then
dbms_output.put_line(t.tn||'已存在');
end;
end loop;
end;
for t in (select table_name tn from user_tables where table_name <> upper(table_name)) loop
begin
for c in (select column_name cn from user_tab_columns where table_name=t.tn) loop
begin
execute immediate 'alter table "'||t.tn||'" rename column "'||c.cn||'" to '||c.cn;
exception
when others then
dbms_output.put_line(t.tn||'.'||c.cn||'已经存在');
end;
end loop;
execute immediate 'alter table "'||t.tn||'" rename to '||t.tn;
exception
when others then
dbms_output.put_line(t.tn||'已存在');
end;
end loop;
end;
相关文章推荐
- Oracle分组ROLLUP、GROUP BY、GROUPING、GROUPING SETS区别和作用
- Oracle函数总结:字符函数
- 调用Oracle存储过程并获取out参数值
- Oracle抓取表结构的语句
- oracle 如何预估将要创建的索引的大小
- oracle错误代码大全(超详细)
- oracle 条件:1=1或1=0,动态添加条件
- oracle 删除表、数据
- java+oracle+web(第九天) java 基础课程(四) 多线程其他小知识 终止、守护、等待
- oracle hanganalyze工具的使用
- 如何限制oracle的trace files及alert file大小
- oracle模糊查询语句使用示例
- oracle存储过程、声明变量、for循环|转|
- Oracle学习(13):数据字典
- oracle单行函数
- oracle ORA-01747(系统保留关键字)user.table.column, table.column 或列说明无效 hibernate映射oracle保留关键字
- (转)oracle常用的数据字典
- Oracle命令行工具基本操作及SQL 命令
- OracleLinux-R7-U1-Server-x86_64下安装oracle-11.2.0.4.0_linux_x86和x86_64
- Oracle 存储过程