Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;ORA-01036:非法变量名称/编号\n“;对于C中的oracle clob#_C#_Oracle_Clob - Fatal编程技术网

C# &引用;ORA-01036:非法变量名称/编号\n“;对于C中的oracle clob#

C# &引用;ORA-01036:非法变量名称/编号\n“;对于C中的oracle clob#,c#,oracle,clob,C#,Oracle,Clob,当我尝试使用C#中的clobinput和output创建oracle存储过程调用时,出现以下错误: ORA-01036: illegal variable name/number\n 下面是代码本身: OracleTransaction transaction = connection.BeginTransaction(); OracleCommand command = connection.CreateCommand(); command.Transaction = transaction

当我尝试使用C#中的
clob
input和output创建oracle存储过程调用时,出现以下错误:

ORA-01036: illegal variable name/number\n
下面是代码本身:

OracleTransaction transaction = connection.BeginTransaction();
OracleCommand command = connection.CreateCommand();
command.Transaction = transaction;
command.CommandText = 
      @"declare xx clob; 
      begin dbms_lob.createtemporary(xx, false, 0); 
      :tempclob := xx; end;";

command.Parameters.Add(new OracleParameter("tempclob", OracleType.Clob))
    .Direction = ParameterDirection.Output;

command.ExecuteNonQuery();

OracleLob tempLob = (OracleLob)command.Parameters[0].Value;
//byte[] tempbuff = new byte[10000];
byte[] tempbuff = System.Text.Encoding.Unicode.GetBytes(generateXMLMessage());

tempLob.BeginBatch(OracleLobOpenMode.ReadWrite);
tempLob.Write(tempbuff, 0, tempbuff.Length);
tempLob.EndBatch();
command.Parameters.Clear();
command.CommandText = "InsertMessageAndGetResponseWRP";
command.CommandType = CommandType.StoredProcedure;
//command.Parameters
//.Add(new OracleParameter("ImportDoc", OracleType.Blob)).Value = tempLob;
command.Parameters.Add(new OracleParameter("iSourceSystem", OracleType.VarChar))
       .Value = "XXX";

command.Parameters.Add(new OracleParameter("iMessage", OracleType.Clob))
       .Value = tempLob;


command.Parameters.Add(new OracleParameter("iResponseMessage", OracleType.Clob)).Direction = ParameterDirection.Output;
command.Parameters.Add(new OracleParameter("retVar ", OracleType.Int32)).Direction = ParameterDirection.Output;

command.ExecuteNonQuery();
transaction.Commit();
试试看

command.CommandText = 
      @"declare xx clob; 
      begin dbms_lob.createtemporary(xx, false, 0); 
      tempclob := xx; end;";

:tempclob
替换为
tempclob

对ExecuteNonQuery()的两个调用中的哪一个产生了错误?我猜是第二个

我不使用C#,但从我在网上找到的几个示例来看,当您使用StoredProcedure命令类型时,似乎不希望创建实际的OracleParameter对象。相反,您可以这样初始化参数:

command.Parameters.Add("iSourceSystem", OracleType.VarChar).Value = "XXX";

看起来您可能正在使用Microsoft Oracle客户端

尝试将Oracle 11客户端与ODP.Net for 4.0一起使用。 这在处理clob时提供了最佳结果

尝试添加:

command.BindByName = true;

调用参数后。

不支持将变量绑定到匿名pl/sql块。使用过程并定义所有参数

command.CommandText = "dbms_lob.createtemporary"

为什么这是一个CW问题?