2017年7月13日 星期四

Oracle SQL Developer 使用者設定路徑&顏色設定路徑 | Oracle SQL Developer user setting path & color theme setting path

from
https://stackoverflow.com/questions/7954759/where-does-oracle-sql-developer-store-connections

connection string path

\Users\[user]\AppData\Roaming\SQL Developer\system3.2.20.09.87\o.jdeveloper.db.connection.{version number}\connections.xml

----------
custome color theme setting path

\Users\[user]\AppData\Roaming\SQL Developer\system3.2.20.09.87\o.sqldeveloper.{version number}\product-preferences.xml

find below xml section:
<hash n="SyntaxColorsOptions">
┌   <value n="selectedScheme" v="{your serring name}"/>
│      <list n="styleList">
│      (copy all this section to your new setting file)
└      </list>

           

2017年5月19日 星期五

windows 工作排程器出現"工作排程器太過忙碌,無法處理您的要求,請稍後再試(0x80041323)" | Windows scheduler got Error 0x80041323

主因:
一個CONSOLE程式,裡面塞了一行CONSOLE READLINE()
排程設定時選擇 以平行執行,頻率是兩分鐘一次
造成大量的執行完程式卡在背景
達到了排程器預設的同時執行程式上限
導致其他後面啟動的排程無法執行

所以要注意不要在定時執行的排程寫會讓它卡住的東西
或者不要用工作排程器,改寫AP,以多執行序執行

(
電腦裡排程器執行程式上限的設定檔參照:
https://support.microsoft.com/zh-tw/help/2696472/error-0x80041323-when-running-high-number-of-scheduled-tasks
More Information的部分
)


2017年3月13日 星期一

Visual Studio 加入現有資料夾 | Visual Studio add existing folder to project

問題發生的緣由:
我寫了一個測試程式,後來想說可以不用測試,開始正式寫了,
就用TFS復原功能回朔到初始狀態,因為那些檔案只有建立,還沒第一次commit,
但後來又要繼續測一些東西了,所以要把回朔的測試程式加回來,
結果發現加入現有項目只有加檔案,但是已經在方案資料夾內的資料夾不知道怎麼加入

後來找到解法:
在方案總管上方按鈕找到顯示所有檔案的按鈕,按下

然後在該資料夾路徑處對虛線資料夾按右鍵選加入至專案,
就可以把連同資料夾在內的檔案全部加入了

2016年10月11日 星期二

c# oracle 撈不出資料 但developer撈有資料 | c# oracle can't get data but data can get when query on developer

環境:
VS2013& 類別庫專案 & C# & Oracle.DataAccess 4.121.1.0
情況:
在oracle developer跑一段select  有幾個變數
select blablabla from table where A=:A and B=:B and C=:C
執行結果有資料
但在C#用OracleDataReader撈到DataTable
dt.Load(odr)
撈出來卻沒資料
印出變數跟sql有正確,也沒有跳exception,
查DB的query log也沒看到有執行這段查詢....

解決:
後來發現是變數塞值的時候順序塞錯了
我寫的是
Parameters.Add("A",A)
Parameters.Add("C",C)
Parameters.Add("B",B)
但應該要照順序去塞入
Parameters.Add("A",A)
Parameters.Add("B",B)
Parameters.Add("C",C)
才可以正常的綁定變數

2016年9月1日 星期四

C# 從Oracle db取多個DataTable結果回來 | C# get multi DataTable result from Oracle DB

參考文章:
http://stackoverflow.com/questions/6149836/filling-multiple-datatables-with-1-oraclecommand

簡單來說就是在db上用 SYS_REFCURSOR 輸出結果
用 open cursor for select的方式就可以把結果丟回來
C#端的程式寫法大致上同CALL SP的方式,
參數設定中輸出的資料集是用OracleDbType.RefCursor這個型別


2016年8月9日 星期二

c# 呼叫oracle sp 出現ora-06502 pl/sql 數字或值錯誤 character string buffer too small | c# call oracle sp get ora-06502

寫sp時遇到ora-06502 pl/sql 數字或值錯誤 character string buffer too small

出錯行數是在我的sp的設定輸出參數文字字串訊息那一行

查了一下後發現是c#端在設定輸出參數時要順便指定大小在第三個參數

oc.Parameters.Add("P_MSG", OracleDbType.NVarchar2, 256).Direction=ParameterDirection.Output;

不然預設的buffer好像很小,多塞幾個字就over了

2016年7月22日 星期五

C# 寫入Oracle 加入變數時出現ArgumentOutOfRangeException | C# insert Oracle db get ArgumentOutOfRangeException when add parameter

語言:C#
DLL:Oracle.DataAccess.Client; 4.121.1.0

在做新增資料時,插入一個常數整數變數,就出錯在那一行

private const int _DEFAULT_VALUE = 0;
OracleCommand oc = new OracleCommand();
oc.CommandText = "insert into Table1 (col1) values(:val1)";
oc.Parameters.Add("val1", _DEFAULT_VALUE);--這行出錯


得到ArgumentOutOfRangeException

Google找到一篇文章
http://brianseekford.com/wordpress/?p=100
說在插入0的時候也出錯了
有個解決辦法是這樣

oc.Parameters.Add("val1", (object)_DEFAULT_VALUE);

把變數轉型為object,結果就過了!
我想應該是驅動程式的BUG

20170510補記
自己又遇到同樣問題 狗回來這一篇
不過有新解法
 oc.Parameters.Add(new OracleParameter(){
                                        ParameterName=":FLAG",
                                        Value=(short)0,
                                        OracleDbType=OracleDbType.Int16
                                    });

這樣的方式也是OK