排除空值我有,我有如下csv文件的情況下(比如FILE.CSV)具有以下數據:如何從參數csv文件傳遞到Oracle更新語句,並從CSV
AcctId,Name,OpenBal,closingbal
1,abc,1000,
2,,0,
3,xyz,,
4,,,
哪能使用unix shell循環遍歷這個文件並且爲例如列$ 2(Name)說明,我想讓Name列的所有發生都接受空值並將它傳遞給例如下面的帶有單引號'',''格式的oracle查詢?
select * from account
where name in (collection of values from csv file column name
but excluding null values)
and openbal in
and same thing for column 3 (collection of values from csv file column Openbal
but excluding null values)
and same thing for column 4 (collection of values from csv file column
closingbal but excluding null values)
簡而言之,我想將csv列值作爲輸入參數傳遞給oracle sql查詢和更新查詢呢?但是我又不想在其中包含空值。如果一列對於所有行都完全爲空,我也想排除它?
之所以採取CSV文件作爲輸入是設計用於用戶的解決方案,因爲用戶被限制運行查詢自己。我們要求用戶將他們指定的參數放在一個csv文件中,並且我們自動將oracle腳本從他們輸入的CSV文件中拾取參數。用戶友好的用戶可以將輸入數據放入CSV文件,這就是爲什麼我們使用這種方法。 – Burair