问题
For a .Net 4.0 application i'm using the OracleClient class from the ODP.Net 11 library. After a bit of research some people note that the ODP.net library can't handle the Windows newlines, but only the unix ones (can't process \r). When I replace every \r occurance with space then query runs fine.
Am I missing something here or is Oracle just being ridiculous?
I'm getting the following error:
Message: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "begin was inserted before "" to continue.
ORA-06550: line 2, column 90:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
回答1:
The /r
is not supported by ODP.NET you have to remove it like this:
OracleCommand cmd = new OracleCommand();
cmd .CommandType = CommandType.Text;
cmd .CommandText = commandText.Replace("\r", "");
来源:https://stackoverflow.com/questions/13306363/oracles-odp-net-cant-handle-newlines-net-newlines