Oracle的ODP.Net无法处理新行.Net新行?

时间:2012-11-09 10:33:05

标签: .net sql oracle odp.net

对于.Net 4.0应用程序,我正在使用ODP.Net 11库中的OracleClient类。经过一些研究,有些人注意到ODP.net库无法处理Windows换行符,只能处理unix的换行符(无法处理\ r)。当我用空格替换每个\ r \ n出现时,查询运行正常。

我在这里遗漏了什么,或者甲骨文是荒谬的?

我收到以下错误:

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 个答案:

答案 0 :(得分:4)

ODP.NET不支持/r,您必须将其删除:

OracleCommand cmd = new OracleCommand();
cmd .CommandType = CommandType.Text;
cmd .CommandText = commandText.Replace("\r", "");