1. 程式人生 > >CVS 匯入oracle 資料庫表

CVS 匯入oracle 資料庫表

轉載:https://blog.csdn.net/jiadianyong12138/article/details/79762155

1.首先在資料庫對應使用者下建表(t_test),欄位型別及名字要與CSV檔案相同。  
2.新建txt(test.txt)檔案輸入:    
load data
infile 'd:/test.csv'       
into table "t_test"    
fields terminated by ','
optionally enclosed by '"'
(ID,WGID) 
test.txt改為test.ctl,
其中infile 'd:/test.csv' 指csv檔案路徑
,into table "t_test"指表名
,fields terminated by ','指欄位以逗號
分隔(csv檔案預設是以逗號分隔)
,optionally enclosed by '"' 表示欄位內有逗號
,(ID,WGID)表示欄位名 


3.開啟cmd輸入:sqlldr userid=user/[email protected]/orcl control=d:\test.ctl log=d:\test.log
user/password :使用者名稱密碼,
@127.0.0.1/orcl:
資料庫所在IP及例項名(orcl)
,control=d:\test.ctl:ctl檔案路徑,