"ORA-01036:C#中oracle clob的非法变量名/数字\n"

use*_*719 9 c# oracle clob

当我尝试使用clobC#中的输入和输出创建一个oracle存储过程调用时,我收到以下错误:

ORA-01036: illegal variable name/number\n
Run Code Online (Sandbox Code Playgroud)

这是代码本身:

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();
Run Code Online (Sandbox Code Playgroud)

Inc*_*ito 1

你试一试

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

:tempclob用。。。来代替tempclob