Oracle's ODP.Net can't handle newlines .Net newlines? [closed]

心已入冬 提交于 2019-12-11 14:05:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!