2009-10-21 18 views
1

我運行此查詢使用的OracleCommand輸出參數讀取記錄的計數:用PL/SQL查詢奇怪的行爲和.net

var query = "declare MyCount number; begin SELECT COUNT(*) INTO :MyCount FROM T_ISSUE; end;"; 

這個工作正常。

但是,如果我將查詢到兩行是這樣的:

var query = @"declare MyCount number; 
       begin SELECT COUNT(*) INTO :MyCount FROM T_ISSUE; end;"; 

我得到follwoing例外:

System.Data.OracleClient.OracleException: ORA-06550: line 1, column 25: 
PLS-00103: Encountered the symbol "" when expecting one of the following: 

    begin function package pragma procedure subtype type use 
    <an identifier> <a double-quoted delimited-identifier> form 
    current cursor 
The symbol "" was ignored. 

有人知道爲什麼嗎?

感謝您的幫助。

回答

4

這是由於VS使用Windows風格的換行符(CR + LF),但Oracle只接受Unix風格(僅LF)。

至少在VB6中就是這種情況。