Oracle的ODP.Net无法处理换行符.Net换行符吗? [英] Oracle's ODP.Net can't handle newlines .Net newlines?

查看:122
本文介绍了Oracle的ODP.Net无法处理换行符.Net换行符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

我在这里错过了什么吗,还是Oracle太荒谬了?

Am I missing something here or is Oracle just being ridiculous?

我遇到以下错误:

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

推荐答案

ODP.NET不支持/r,您必须这样删除它:

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", "");

这篇关于Oracle的ODP.Net无法处理换行符.Net换行符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆