批量將表名變為大寫
begin
for c in (select table_name tn from user_tables where table_name <> upper(table_name)) loop
begin
execute immediate 'alter table "'||c.tn||'" rename to '||c.tn;
exception
when others then
dbms_output.put_line(c.tn||'已存在');
end;
end loop;
end;
批量將空間內所有表的所有欄位名變成大寫 此方法可能導致溢位
begin
for t in (select table_name tn from user_tables) 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;
end;
end loop;
end;
將特點表property_info的所有列名小寫變大寫
begin
for c in (select column_name cn from all_tab_columns where table_name='property_info') loop
begin
execute immediate 'alter table property_info rename column "'||c.cn||'" to '||c.cn;
exception
when others then
dbms_output.put_line('property_info'||'.'||c.cn||'已經存在');
end;
end loop;
end;
單個改表名
alter table "小寫表名" rename to 大寫表名
單個改欄位
alter table 表名rename column "小寫字段" to "大寫字段";
MySQL批量將表名或者列名大小寫轉換
批量操作表名大小寫轉換 select concat alter table table name,rename to lower table name as 修改指令碼 from information schema.tables where table schema 資料庫名 替換即可 執行結果 ...
Oracle根據字段值找到表名和列名
方法1 oracle 根據字段值查詢其所在的表 字段 declare cursor cur query is select table name,column name,data type from user tab columns a number sql hard varchar2 2000 v...
oracle查詢表名,不區分大小寫
示例 select table name,tablespace name,temporary from user tables where table name like prov 分析 table name 表名 varchar2 30 tablespace name 儲存表名的表空間 varch...