ORACLE表字段名稱改為大寫的方法

2021-06-25 09:24:28 字數 642 閱讀 6450

一些資料庫的表字段名稱不區分大小寫(如sqlserver),在通過資料匯入方式匯出到oracle後,會因為欄位名稱的大小寫問題帶來很多麻煩。

在資料匯入到oracle後,可以使用如下方式將oracle中的字段轉換為大寫:

plsql 新建sql窗體 中執行

begin

dbms_output.enable (buffer_size=>null) ;

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;

查詢oracle表字段名稱

select column name,data type,data length from all tab columns where table name t cakey select from user tables 查詢當前使用者所擁有的表 select from dba tables 擁有d...

oracle 修改 欄位名稱

暫時應該沒有對應的方法,所以我用自己想好的方法去修改 修改原欄位名 name 為name tmp,是將想改名稱的字段改為沒用 臨時的字段 alter table 表名 rename column 老欄位 to 新字段 增加乙個和原欄位名同名的字段 name alter table 表名 add 老欄...

SQL 語句獲取表字段名稱,屬性

獲取表字段名稱,屬性 select 表名 case when a.colorder 1 then d.name else end 表說明 case when a.colorder 1 then isnull f.value,else end 字段序號 a.colorder,欄位名 a.name,標識...