[Mono-bugs] [Bug 424908] New: Oracle - stored procedure returning string throws exception - Size must be set

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 9 15:08:57 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=424908


           Summary: Oracle - stored procedure returning string throws
                    exception - Size must be set
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: x86-64
        OS/Version: SLES 10
            Status: NEW
          Severity: Blocker
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: webservices at landmarkdigital.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


When a stored procedure returns a value through an OUT string parameter, the
constructor ignores the size parameter and crashes, complaining  that the size
is not set. (although you should not have to specify it anyway)

-----------------------------------------------------------
With the following pl/sql stored procedure:
-----------------------------------------------------------

  ----------------------------------------------------------------------
  -- GetProviderDesc
  --   Returns the textual description for the provider with the given ID
  ----------------------------------------------------------------------
  PROCEDURE  GetProviderDesc
    (
      providerID        IN PROVIDER.PROVIDER_ID%type,
      providerDesc     OUT PROVIDER.PROVIDER_DESC%type -- which is NVarChar
    )
  AS
  BEGIN

    SELECT PROVIDER.PROVIDER_DESC INTO providerDesc
      FROM PROVIDER
     WHERE PROVIDER.PROVIDER_ID = providerID;

  END; -- PROCEDURE  ListAuditSamples

-----------------------------------------------------------
using the following code:
-----------------------------------------------------------

      System.Data.OracleClient.OracleParameter providerDesc = new
System.Data.OracleClient.OracleParameter();
      providerDesc.ParameterName = "providerDesc";
      providerDesc.OracleType    =
System.Data.OracleClient.OracleType.NVarChar;
      providerDesc.Direction     = System.Data.ParameterDirection.Output;
      providerDesc.Value         = string.Empty;


      // if size is not set, and even if size is set in parameter
constructor,exception 'Size must be set.' is thrown
      //   at System.Data.OracleClient.OracleParameter.AssertSizeIsSet ()
[0x00000]
      //   at System.Data.OracleClient.OracleParameter.Bind
(System.Data.OracleClient.Oci.OciStatementHandle statement,
System.Data.OracleClient.OracleConnection con, UInt32 pos) [0x00000]
      //   at (wrapper remoting-invoke-with-check)
System.Data.OracleClient.OracleParameter:Bind
(System.Data.OracleClient.Oci.OciStatementHandle,System.Data.OracleClient.OracleConnection,uint)
      //   at System.Data.OracleClient.OracleCommand.BindParameters
(System.Data.OracleClient.Oci.OciStatementHandle statement) [0x00000]
      //   at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal
(System.Data.OracleClient.Oci.OciStatementHandle statement, Boolean
useAutoCommit) [0x00000]
      //   at System.Data.OracleClient.OracleCommand.ExecuteNonQuery ()
[0x00000]
      // i.e., Size must be set independently from OracleParameter constructor

      ExecuteStoredProcedure ( PKG_NAME + ".GetProviderDesc", //string
procName,
                                                 new
System.Data.OracleClient.OracleParameter[] {
                                                    
CreateNumberParam("providerID", providerID),
                                                     providerDesc
                                                   } );

      System.Console.WriteLine("providerDesc = '" + providerDesc.Value + "'");


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list