一次取得所有待刪除資料的ROWID,然後分批小量刪除資料
Set Serveroutput On;
DECLARE
V_DATE DATE;
Type V_Rowid Is Table Of Varchar2(100) Index By Binary_Integer;
Var_Rowid V_Rowid;
Cursor V_Cur Is Select /*+parallel(a,2)*/Rowid From Hr.Employee Where LoginDate <= V_Date;
Begin
V_Date := To_Date(To_Char(Trunc(Sysdate-60),'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS');
Open V_Cur ;
Loop
Fetch V_Cur Bulk Collect
Into Var_Rowid Limit 10000;
Forall I In 1 .. Var_Rowid.Count
Delete From Hr.Employee Where Rowid =Var_Rowid(I);
Commit;
Exit When V_Cur%Notfound Or V_Cur%Notfound Is Null;
End Loop;
Close V_Cur;
End;
2015年5月10日 星期日
2015年4月17日 星期五
[Oracle]如何在SQLPlus格式化輸出成CSV
SQLPlus預設環境下有很多System Variable,如果沒特別去設定,用SPOOL輸出到文字檔時,可能會看到一些不乾淨資料,像是表頭、回傳筆數及統計時間等等的
如下圖,配合一些System Variable設定就可以不顯示了
如下圖,配合一些System Variable設定就可以不顯示了
2015年3月26日 星期四
[Power Map]地圖信賴度的問題
用city來當作Power Map的地理資訊時,發現有各地圖信賴度,只能辨識出49%的資料,想說怎麼那麼低,報告建議再增加更多的地理欄可提升信賴度,於是又加了country code進去,馬上提升至89%
2015年3月23日 星期一
2015年3月5日 星期四
[SSIS]Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available.
Warning: 0x80049304 at Data Flow Task, SSIS.Pipeline: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available. To resolve, run this package as an administrator, or on the system's console.
印象中以前用BIDS或SSDT沒看過這警示訊息,但用VS 2013設計SSIS專案時就看到這個警示,解法就如訊息中說的右鍵[以系統管理員的身分]執行,就不會出現囉
印象中以前用BIDS或SSDT沒看過這警示訊息,但用VS 2013設計SSIS專案時就看到這個警示,解法就如訊息中說的右鍵[以系統管理員的身分]執行,就不會出現囉
[SSIS]OLE DB Source連Oracle的錯誤Cannot retrieve the column code page info from the OLE DB provider.
Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used.
就在我按下Preview或是Columns時
就在我按下Preview或是Columns時
2015年2月5日 星期四
[T-SQL]如何判斷IP是否落在某段IP範圍內?
最近要測試Excel的Power Map,一般系統不會記錄使用者的地理資訊,頂多記IP吧,稍微查了Get and prep your data for Power Map,裡面提到Power Map的地理資訊支援下列幾種
下載回來的資料是csv,我一開始轉入DB時發現一些問題,資料會有亂碼,用Unicode轉進去會剖析不了,發現編碼好像怪怪的,所以調成下圖那樣就可以匯入了
Latitude/Longitude pair, City, Country/Region, Zip code/Postal code, State/Province, or Address用經緯度分析資料除非資料量非常大,要不然量小看起來沒什意義,那收斂到City感覺比較合理,所以找了一下如何用IP轉City,當然網上一堆服務可以用,但我不想讓DB層對外,想看有沒有現成的對應表可用,結果DB-IP - IP Geolocation and Network Intelligence有現成的DB可下載,免費版的可就可對應到city耶,五百萬筆資料應該也夠測試了 ,於是就下載來試試
下載回來的資料是csv,我一開始轉入DB時發現一些問題,資料會有亂碼,用Unicode轉進去會剖析不了,發現編碼好像怪怪的,所以調成下圖那樣就可以匯入了
訂閱:
文章 (Atom)





