2012-04-16 5 views
-1

나는 아주 간단한 오라클 SPODBC 드라이버 : 구문 오류 또는 액세스 위반

CREATE OR REPLACE procedure DEV.SL_CLOB_TEST(numId IN PLS_INTEGER,id IN PLS_INTEGER, strText IN CLOB) 
as 
begin 
    insert into test_table values (numId,id, strText, sysdate, user); 
end; 

하고 난

static void Main(string[] args) 
    { 
     string connectionString = "Driver={Microsoft ODBC for Oracle};Server=server;Uid=username;Pwd=password"; 
     var connection = new OdbcConnection(connectionString); 
     connection.Open(); 

     IDbCommand command = connection.CreateCommand(); 

     command.CommandText = "{call SL_CLOB_TEST(?,?,?)}"; 
     command.CommandType = CommandType.StoredProcedure; 

     OdbcParameter parameter1 = new OdbcParameter("NUMID", OdbcType.Int); 
     parameter1.Value = 123; 
     parameter1.Direction = ParameterDirection.Input; 
     command.Parameters.Add(parameter1); 

     OdbcParameter parameter2 = new OdbcParameter("ID", OdbcType.Int); 
     parameter2.Value = 234; 
     parameter2.Direction = ParameterDirection.Input; 
     command.Parameters.Add(parameter2); 

     OdbcParameter parameter3 = new OdbcParameter("STRTEXT", OdbcType.VarChar); 
     parameter3.Value = getClob(); 
     parameter3.Direction = ParameterDirection.Input; 
     command.Parameters.Add(parameter3); 

     command.ExecuteNonQuery(); 
    } 

    private static string getClob() 
    { 
     return new string('a', 10); 
    } 
} 

위의 SP를 소모하기 위해 클라이언트 닷넷 4.0 코드가 언제 오류가 발생했습니다. 오류 [42000] [Microsoft] [Oracle 용 ODBC 드라이버] 구문 오류 또는 액세스 위반 전체 호출 스택이

System.Data.Odbc.OdbcException이었다 처리되지 않은 메시지 = ERROR [42000] [마이크로 소프트] [ODBC Oracle 용 드라이버] 구문 오류 또는 액세스 위반
출처 = msorcl32.dll있는 ErrorCode = -2146232009 스택 트레이스 : System.Data에서 .Odbc.OdbcConnection.HandleError (OdbcHandle hrHandle, RETCODE의 RETCODE) System.Data.Odbc.OdbcCommand.ExecuteReaderObject에서 (CommandBehavior를 동작 문자열에있어서, 부울 needReader이 Object [] methodArguments, SQL_API odbcApiMethod) System.Data에서 . Odbc.OdbcCommand.ExecuteReaderObject (CommandBehavior 동작, String 메서드, 부울 needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at Conso D : \ Temp \ ConsoleApplication1 \ ConsoleApplication1 \ Program.cs의 32 행에 (System.AppDomain._nExecuteAssembly (RuntimeAssembly 어셈블리, String [] args) at System.AppDomain.ExecuteAssembly (문자열 assemblyFile, 증거 assemblySecurity 문자열 [] 인수) System.Threading.ExecutionContext.Run에서 System.Threading.ThreadHelper.ThreadStart_Context (객체 상태)에서 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()에서 (ExecutionContext에의 ExecutionContext , ContextCallback 콜백, 개체 상태, 부울 ignoreSyncCtx) System.Threading.ThreadHelper.ThreadStart()의 에서 System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback 콜백, 개체 상태) nnerException :

여기 오류 메시지는 무엇이 잘못되었는지 명확하지 않습니다. 아무도 내가 들여다 볼만한 단서가 있습니까?

답변

0

다른 테스트를 수행하고 SP의 CLOB에서 varchar2로 데이터 유형을 변경하기 만하면 코드가 최대 31.75K 문자열 크기를 SP로 보낼 수있는 제한 사항과 함께 작동합니다.

관련 문제