PLSQLAssociativeArray - ArraybindSize

Hello all,
Does anybody know the maximum size of an output parameter for ArrayBindSize when accessing a table of varchar2. And if so is their a way to set the limit?
Right now I can go to a maximium of 2000 characters.
thanks,
Dhaval

Actually odp.net limits us:
"ArrayBindSize is used only for parameter types that have variable length such as Clob, Blob and Varchar2. The size is represented in bytes for binary datatypes and characters for the Unicode string types. The count for string types does not include the terminating character. The size is inferred from the actual size of the value, if it is not explicitly set. For an output parameter, the size of each value is set by ODP.NET. The ArrayBindSize property is ignored for fixed length datatypes. "
But the doc doesn't state what size and whether if we can change the size or not. I know Microsoft's driver supports 4000 bytes (so I don't know why oracle would lessen the # of bytes returned).

Similar Messages

  • ArrayBindSize and Size for PLSQLAssociativeArrays

    Hey there,
    I'm a complete newbie to ODP.NET and was hoping someone may be able to help with an issue. I basically need to call an SP from a VB.NET application and got as far as I could with the code below. The problem is that the parameters associates to this SP are all direction output. As a result, i'm having trouble trying to use the ArrayBindSize property and the Size property since I don't know what the number/size of the output from running the SP will exactly be? Does anyone see my predicament?
    I'm also seeing the following errors when I try to compile my application:
    Value of type '1-dimensional array of String' cannot be converted to '1-dimensional array of Integer' because 'String' is not derived from 'Integer'.
    Thanks in advance!
    Public Function RunSPReturnDS()
    Try
    Dim oraConnString As String = "Data Source=*****;User Id=******;Password=*****;"
    Dim oraConnection As New OracleConnection(oraConnString)
    oraConnection.Open()
    MessageBox.Show("Connection works!", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    oracleCMD = oraConnection.CreateCommand
    oracleCMD.CommandType = CommandType.StoredProcedure
    oracleCMD.CommandText = "OCDI_UTILITIES.GET_EXISS_TODAY"
    pStatus = New OracleParameter("P_STATUS", OracleDbType.Int32)
    pStatusText = New OracleParameter("P_STATUS_TEXT", OracleDbType.Varchar2)
    pRecReturned = New OracleParameter("P_RECORDS_RETURNED", OracleDbType.Int32)
    pMsgSysNameList = New OracleParameter("P_MSG_SYSTEM_NAME_LIST", OracleDbType.Varchar2)
    pMsgLastInDateTime = New OracleParameter("P_MSG_LAST_IN_DATETIME_LIST", OracleDbType.Date)
    pMsgGoodIn = New OracleParameter("P_MSG_GOOD_IN_LIST", OracleDbType.Int32)
    pMsgBadIn = New OracleParameter("P_MSG_BAD_IN_LIST", OracleDbType.Int32)
    pMsgLastOutDateTime = New OracleParameter("P_MSG_LAST_OUT_DATETIME_LIST", OracleDbType.Date)
    pMsgGoodOut = New OracleParameter("P_MSG_GOOD_OUT_LIST", OracleDbType.Int32)
    pMsgBadOut = New OracleParameter("P_MSG_BAD_OUT_LIST", OracleDbType.Int32)
    pStatus.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pStatusText.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pRecReturned.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgSysNameList.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgLastInDateTime.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgGoodIn.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgBadIn.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgLastOutDateTime.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgGoodOut.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pMsgBadOut.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    pStatus.Direction = ParameterDirection.Output
    pStatusText.Direction = ParameterDirection.Output
    pRecReturned.Direction = ParameterDirection.Output
    pMsgSysNameList.Direction = ParameterDirection.Output
    pMsgLastInDateTime.Direction = ParameterDirection.Output
    pMsgGoodIn.Direction = ParameterDirection.Output
    pMsgBadIn.Direction = ParameterDirection.Output
    pMsgLastOutDateTime.Direction = ParameterDirection.Output
    pMsgGoodOut.Direction = ParameterDirection.Output
    pMsgBadOut.Direction = ParameterDirection.Output
    pStatus.Size = 10
    pStatusText.Size = 10
    pRecReturned.Size = 10
    pMsgSysNameList.Size = 10
    pMsgLastInDateTime.Size = 10
    pMsgGoodIn.Size = 10
    pMsgBadIn.Size = 10
    pMsgLastOutDateTime.Size = 10
    pMsgGoodOut.Size = 10
    pMsgBadOut.Size = 10
    'pStatus.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pStatusText.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pRecReturned.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgSysNameList.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgLastInDateTime.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgGoodIn.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgBadIn.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgLastOutDateTime.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgGoodOut.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    'pMsgBadOut.ArrayBindSize = New Int32(10) {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}
    pStatus.ArrayBindSize = BindArraysToSizeInt()
    pStatusText.ArrayBindSize = BindArraysToSizeStr()
    pRecReturned.ArrayBindSize = BindArraysToSizeInt()
    pMsgSysNameList.ArrayBindSize = BindArraysToSizeStr()
    pMsgLastInDateTime.ArrayBindSize =
    pMsgGoodIn.ArrayBindSize = BindArraysToSizeInt()
    pMsgBadIn.ArrayBindSize = BindArraysToSizeInt()
    pMsgLastOutDateTime.ArrayBindSize =
    pMsgGoodOut.ArrayBindSize = BindArraysToSizeInt()
    pMsgBadOut.ArrayBindSize = BindArraysToSizeInt()
    oracleCMD.Parameters.Add(pStatus)
    oracleCMD.Parameters.Add(pStatusText)
    oracleCMD.Parameters.Add(pRecReturned)
    oracleCMD.Parameters.Add(pMsgSysNameList)
    oracleCMD.Parameters.Add(pMsgLastInDateTime)
    oracleCMD.Parameters.Add(pMsgGoodIn)
    oracleCMD.Parameters.Add(pMsgBadIn)
    oracleCMD.Parameters.Add(pMsgLastOutDateTime)
    oracleCMD.Parameters.Add(pMsgGoodOut)
    oracleCMD.Parameters.Add(pMsgBadOut)
    oracleCMD.ExecuteNonQuery()
    For i As Integer = 0 To pStatus.Size - 1
    Console.WriteLine(pStatus.Value(i))
    Next
    'ListView1.Items(3).SubItems.Add(P_STATUS)
    pStatus.Dispose()
    pStatusText.Dispose()
    pRecReturned.Dispose()
    pMsgSysNameList.Dispose()
    pMsgLastInDateTime.Dispose()
    pMsgGoodIn.Dispose()
    pMsgBadIn.Dispose()
    pMsgLastOutDateTime.Dispose()
    pMsgGoodOut.Dispose()
    pMsgBadOut.Dispose()
    oracleCMD.Dispose()
    oraConnection.Dispose()
    Catch ex As Exception
    MessageBox.Show(ex.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
    End Function
    Private Function BindArraysToSizeInt() As Integer()
    Dim ArrBindSizeInt(collectionObjectsInt.Count - 1) As Integer
    For i As Integer = 0 To collectionObjectsInt.Count - 1
    ArrBindSizeInt(i) = collectionObjectsInt(i).ToString().Length
    Next i
    Return ArrBindSizeInt
    End Function
    Private Function BindArraysToSizeStr() As String()
    Dim ArrBindSizeStr(collectionObjectsStr.Count - 1) As String
    For i As Integer = 0 To collectionObjectsStr.Count - 1
    ArrBindSizeStr(i) = collectionObjectsStr(i).ToString().Length
    Next i
    Return ArrBindSizeStr
    End Function
    End Class

    Well - yes and no :-)
    When it comes to desktop displays then historically the term resolution has been used to describe only the Pixel Dimensions of the physical display and not the pixels per unit of measurement. Typically we don't bother any more about the screen PPI because its usually high enough not to be a problem.
    Projectors on the other hand display the image on varying screen sizes due to the distance from the screen. This makes resolution in terms of PPI important again. Yes, the projector has 'fixed' pixel dimensions but because the screen size varies the PPI will also vary. The further away the screen gets the larger the Pixels get and at some distance the image gets very 'pixellated' i.e you start to see the actual pixels.
    The other thing to keep in mind is that projectors are typically driven from a PC ( I guess we should include the Mac folks in this :-) )which may have a resolution (pixel dimensions) much higher than the projector. This may mean that you have to change the display properties on your PC to match or you may be lucky that the projector can re-sample for you.
    To answer the OP then the resolution in terms of PPI is more a question of controlling the distance between projector and screen and you need to check this visually although the venue may limit what you can actually do.
    In terms of Image Size (Pixel Dimensions) then I would say it depends on how critical you and your audience are, but to be honest there are probably other factors like colour, brightness and contrast that are going to be bigger issues than image sharpness.
    Colin #2

  • PLSQLAssociativeArray

    Hi,
    I've found a sample code on http://download-uk.oracle.com/docs/html/B10961_01/features.htm#1024855
    I modified the code a little.
                   OracleCommand cmd = new OracleCommand("begin MyPack.TestVarchar2(:1, :2, :3); end;", dbConn);
                   OracleParameter Param1 = new OracleParameter();
                   OracleParameter Param2 = new OracleParameter();
                   OracleParameter Param3 = new OracleParameter();
                   Param1.ParameterName = "1";
                   Param1.ParameterName = "2";
                   Param1.ParameterName = "3";
                   Param1.OracleDbType = OracleDbType.Varchar2;
                   Param2.OracleDbType = OracleDbType.Varchar2;
                   Param3.OracleDbType = OracleDbType.Varchar2;
                   Param1.Direction = ParameterDirection.Input;
                   Param2.Direction = ParameterDirection.InputOutput;
                   Param3.Direction = ParameterDirection.Output;
                   // Specify that we are binding PL/SQL Associative Array
                   Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                   Param2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                   Param3.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                   // Setup the values for PL/SQL Associative Array
                   Param1.Value = new string[3]{"Papa",
                                                           "Mama",
                                                           "Gyerekek"};
                   Param2.Value = new string[3]{"First Element",
                                                           "Second Element",
                                                           "Third Element"};
                   Param3.Value = new string[3]{"1",
                                                           "2",
                                                           "3"};
                   // Specify the maximum number of elements in the PL/SQL Associative Array
                   Param1.Size = 3;
                   Param2.Size = 3;
                   Param3.Size = 3;
                   // Setup the ArrayBindSize for Param1
                   Param1.ArrayBindSize = new int[3]{13, 14, 13};
                   cmd.Parameters.Add(Param1);
                   cmd.Parameters.Add(Param2);
                   cmd.Parameters.Add(Param3);
                   // Setup the ArrayBindStatus for Param1
                   Param1.ArrayBindStatus = new OracleParameterStatus[3]{
                                                                                         OracleParameterStatus.Success,
                                                                                         OracleParameterStatus.Success,
                                                                                         OracleParameterStatus.Success};
                   // Setup the ArrayBindSize for Param2
                   Param2.ArrayBindSize = new int[3]{20, 20, 20};
                   // Setup the ArrayBindSize for Param3
                   Param3.ArrayBindSize = new int[3]{20, 20, 20};
                   // execute the cmd
                   cmd.ExecuteNonQuery();
                   //print out the parameter's values
                   Console.WriteLine(Param2.ToString());
                   Console.WriteLine(Param3.ToString());
    In Oracle:
    CREATE PACKAGE MYPACK AS
    TYPE AssocArrayVarchar2_t is table of VARCHAR(20) index by BINARY_INTEGER;
    PROCEDURE TestVarchar2(
    Param1 IN AssocArrayVarchar2_t,
    Param2 IN OUT AssocArrayVarchar2_t,
    Param3 OUT AssocArrayVarchar2_t);
    END MYPACK;
    CREATE PACKAGE BODY MYPACK AS
    PROCEDURE TestVarchar2(
    Param1 IN AssocArrayVarchar2_t,
    Param2 IN OUT AssocArrayVarchar2_t,
    Param3 OUT AssocArrayVarchar2_t)
    IS
    i integer;
    BEGIN
    -- copy a few elements from y to z
    Param3(1) := Param2(1);
    Param3(2) := NULL;
    Param3(3) := Param2(3);
    -- copy all elements from x to y
    Param2(1) := Param1(1);
    Param2(2) := Param1(2);
    Param2(3) := Param1(3);
    FOR i IN 1..3 LOOP
    insert into T1 values(i, Param2(i));
    END LOOP;
    FOR i IN 1..3 LOOP
    select COL2 into Param2(i) from T2 where COL1 = i;
    END LOOP;
    END TestVarchar2;
    END MYPACK;
    But I don't get any character on console. WHY?

    Hi,
    From
    http://download-west.oracle.com/docs/cd/B19306_01/win.102/b14307/featOraCommand.htm#BABBDHBB
    <snippet>
    // execute the cmd
    cmd.ExecuteNonQuery();
    //print out the parameter's values
    Console.WriteLine("parameter values after executing the PL/SQL block");
    for (int i = 0; i < 3; i++)
    Console.WriteLine("Param2[{0}] = {1} ", i,
    (cmd.Parameters[1].Value as Array).GetValue(i));
    for (int i = 0; i < 3; i++)
    Console.WriteLine("Param3[{0}] = {1} ", i,
    (cmd.Parameters[2].Value as Array).GetValue(i));
    </snippet>
    Cheers,
    Greg

  • OracleParameter.ArrayBindSize is invalid

    Hi,
    Getting "OracleParameter.ArrayBindSize is invalid" error while using 'ArrayBindCount' method.
    We are getting this error while using VARCHAR2 as an OUT parameter in the stored procedure.
    'ArrayBindCount' works when we return NUMBER as an OUT parameter.
    Stored Procedure Implementation
    CREATE OR REPLACE PACKAGE SP_TEST_PA AS
    PROCEDURE SP_TEST_PR(i_str_flg IN VARCHAR2,
    o_str_err_code OUT VARCHAR2,
    o_num_status OUT NUMBER) ;
    END SP_TEST_PA;
    CREATE OR REPLACE PACKAGE BODY SP_TEST_PA AS
    PROCEDURE SP_TEST_PR(i_str_flg IN VARCHAR2,
    o_str_err_code OUT VARCHAR2,
    o_num_status OUT NUMBER) AS
    BEGIN
         o_str_err_code := 'SUCCESS';
         o_num_status := 0;
    EXCEPTION
    WHEN OTHERS THEN
         o_str_err_code := 'ERROR';
    o_num_status := 1;
    END SP_TEST_PR;
    END SP_TEST_PA ;
    VB.NET Code Implementation
    Imports Oracle.DataAccess.Client
    Dim lOCon As OracleConnection
    Dim lOCmd As OracleCommand
    Dim lOPRFlag As New OracleParameter("i_str_flg", OracleDbType.Varchar2, ParameterDirection.Input)
    Dim lOPRErrorCode As New OracleParameter("o_str_err_code", OracleDbType.Varchar2, ParameterDirection.Output)
    Dim lOPRStatus As New OracleParameter("o_num_status", OracleDbType.Decimal, ParameterDirection.Output)
    Dim lIntArrayCount As Integer
    Dim lArrFlag() As String = New String() {"N"}
    Dim lArrErrCode() As String = New String() {"Y"} ' Default Value
    Dim lArrStatus() As Integer = New Integer() {0} ' Default Value
    Dim lStrProcedureName As String = "SP_TEST_PA.SP_TEST_PR"
    Try
    ' Assign the values to the parameter
    lOPRFlag.Value = lArrFlag
    lOPRErrorCode.Value = lArrErrCode
    lOPRStatus.Value = lArrStatus
    ' Set the ArrayCount for command to max. number of rows in the preceding arrays
    lIntArrayCount = lArrStatus.Length
    lOCon = New OracleConnection(CommonFunctionality.GetDBConnectionString)
    lOCon.Open()
    lOCmd = New OracleCommand(lStrProcedureName, lOCon)
    lOCmd.CommandType = CommandType.StoredProcedure
    ' Bind the Length
    lOCmd.ArrayBindCount = lIntArrayCount
    lOCmd.Parameters.Add(lOPRFlag)
    lOCmd.Parameters.Add(lOPRErrorCode)
    lOCmd.Parameters.Add(lOPRStatus)
    lOCmd.ExecuteNonQuery()
    Catch ex As Exception
    Finally
    ' Clean-up Activities
    If Not (lOCmd Is Nothing) Then
    lOCmd.Connection.Close()
    lOCmd.Dispose()
    End If
    lOCmd = Nothing
    If Not (lOCon Is Nothing) Then
    If lOCon.State <> ConnectionState.Closed Then
    lOCon.Close()
    End If
    lOCon.Dispose()
    End If
    lOCon = Nothing
    End Try
    Pl. help us.
    Thanks & Regards,
    Aditya from India

    It does not look like you've set the ArrayBindSize property as required:
    "For binding a PL/SQL Associative Array, whose elements are of a variable-length element type, as an InputOutput , Out, or ReturnValue parameter, this property must be set properly."
    - Oracle Data Provider for .NET Library, OracleParameter.ArrayBindSize
    If you go to the ODP.NET home page and scroll to the bottom, you can get a sample download of 2 chapters from Pro .NET Oracle Programming (as of 16 JUN 2005). The ODP.NET home page can be found here:
    http://www.oracle.com/technology/tech/windows/odpnet/index.html
    Chapter 5 (which is part of the sample chapters) discusses working with PL/SQL and PLSQLAssociativeArray.
    - Mark

  • 'ArrayBindSize is invalid' calling DBMS_DESCRIBE.DESCRIBE_PROCEDURE

    I'm trying to call DBMS_DESCRIBE.DESCRIBE_PROCEDURE to get a listing of all of the parameters for a stored procedure. I'm having trouble getting the parameters created properly. Most of the params are declared as one of the following:
    overload OUT NUMBER_TABLE,
    argument_name OUT VARCHAR2_TABLE,
    I've been using the following code (overload, for example):
    m_Command.Parameters.Add("overload", OracleDbType.Double, 200, DBNull.Value, ParameterDirection.Output);
    m_Command.Parameters[n].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    m_Command.Parameters[n].ArrayBindSize = ???;
    I've tried setting ArrayBindSize to several different values, but I always seem to get the following error message "OracleParameter.ArrayBindSize is invalid".
    Thoughts?
    Also, in ADO, you used to be able to call Command.Refresh, which would populate the Parameters object for you (slow as it may have been). Is there anything similar available for ODP?
    Any help would be greatly appreciated.

    The DBMS_DESCRIBE.DESCRIBE_PROCEDURE contains Nested Table type parameters. Since ODP.NET does not support Nested Table type, it is not possible to execute the DBMS_DESCRIBE.DESCRIBE_PROCEDURE at this time. The Nested Table, VArray, Object supports will be evaluated in the near future.
    Thanks
    Martha

  • ArrayBindSize-implicit (-1) length not valid for this bind or define dataty

    Hello all,
    This has been troubling me for a couple of days.
    I am retriving an oracle type of varchar2 table:
    TYPE VARCHAR2_TABLE IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
    I create the following array:
    'size of the array
    Dim intValue(4000) As Integer
    Dim idx As Integer = 0
    While idx < intValue.Length
    'assingning 4000 tells that each row size
    'will be of 4000 characters
    intValue(idx) = 4000
    idx = idx + 1
    End While
    Then I assign it to the parameter:
    Dim param As OracleParameter = cmd.Parameters.Add("sBuffer", OracleDbType.Varchar2)
    param.Direction = ParameterDirection.Output
    param.Size = intValue.Length
    param.CollectionType = OracleCollectionType.PLSQLAssociativeArray
    param.ArrayBindSize = intValue
    when I execute the query I get the error:
    implicit (-1) length not valid for this bind or define datatype
    However, if i assign each row the size of 2000 or less it returns fine. But this limits me to getting only 2000 characters. And our current system returns 4000 characters.
    If any one has a solution, please post it.
    thanks,
    Dhaval

    Ok I've now found the patchsets and have ODP.NET 9.2.0.420 up and running - which is a start!
    The 2000 character limit as discussed above does indeed seem to have gone - great! BUT: I'm now running into another limit:
    It seems as though ODP.NEt and/or the layers below reserve 3 bytes of memory for every character when binding a PLSQLAssociativeArray OUTPUT parameter. Due to what looks like the old 16Mb-per-array limit I used to encounter when using Microsoft OLEDB Provider for Oracle, this means that, for an array of VARCHAR2(4000), the maximum number of rows (array elements) I can get back is 1398, before I get an exception with the message:
    "ORA-01044: size 16788000 of buffer bound to variable exceeds maximum 16777216 occured"
    When using the Microsoft OLEDB Provider there seems to be a 1-byte-per-character sizing going on, since I can get up to 4194 rows (array elements) back from the same stored procedure.
    Any reasoning behind the 3-bytes per character with ODP.NET?

  • ODP ArrayBindSize

    My Oracle Package Procedure signature is
    PROCEDURE Get_Object_Details(
    p_ObjectID IN VARCHAR2,
    p_FullLoad IN VARCHAR2,
    p_PropName OUT gt_PropNames,
    p_PropValue OUT gt_PropValues,
    gt_PropNames,gt_PropValues etc. are of type table and definition is as follows.
    TYPE gt_PropNames IS TABLE OF VARCHAR2(50)INDEX BY BINARY_INTEGER;
    I want to execute the Procdure from my .NET application using ODP.
    Sample Code which i am using is :
    string strConnString = "User Id=xyz;Password=xyz;Data
    Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Abc)(PORT = 1521)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = EX_SID)));";
    OracleParameter param_ObjectID = new
    OracleParameter("p_ObjectID",OracleDbType.Int32);
    param_ObjectID.Direction = ParameterDirection.Input;
    param_ObjectID.Value = Convert.ToInt32(6);
    OracleParameter strFullLoad = new
    OracleParameter("p_FullLoad",OracleDbType.Varchar2);
    strFullLoad.Direction = ParameterDirection.Input;
    strFullLoad.Value = "T";
    OracleParameter p_PropName = new
    OracleParameter("p_PropName",OracleDbType.Varchar2);
    p_PropName.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_PropName.Direction = ParameterDirection.Output;
    p_PropName.Size = 1000;
    OracleParameter p_PropValue = new OracleParameter("p_PropValue",
    OracleDbType.Varchar2);
    p_PropValue.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_PropValue.Direction = ParameterDirection.Output;
    p_PropValue.Size = 1000;
    OracleParameter[] param =
    {param_ObjectID,strFullLoad,p_PropName,p_PropValue};
    try
    OracleHelper.ExecuteNonQuery(strConnString,CommandType.StoredProcedure,"PKG1.Procedure1",param);
    catch(Exception ee)
    MessageBox.Show(ee.Message.ToString());
    But is giving any Error. The Error is OracleParameter.ArrayBindSize is invalid.
    I don't want to Set this property at design time. Because.. it is dynamic.
    Please Post same sample code.

    I am guessing you got this working already but here it is just in case somebody else could use it.
              // allows one to build a variable sized array
              private static OracleParameter BuildAssociativeArray(
                   string paramName
                   ,OracleDbType paramType
                   ,object[] values
                   ,int bindSize
                   ,ParameterDirection paramDirection
                   ,bool skipNullItems)
                   int                    paramSize = 0;
                   object[]     paramValues;
                   // set the parameter size and load up the parameter values and bind size
                   if (!skipNullItems)
                        paramSize = values.Length;
                   else
                        for (int i = 0; i < values.Length; i++)
                             if (values[i] != null)
                                  paramSize++;
                             else
                                  break; // stop at first null
                   paramValues = new object[paramSize];
                   int[] bindArray = new int[paramSize];
                   for (int i = 0; i < paramSize; i++)
                        paramValues[i] = values;
                        bindArray[i] = bindSize;
                   // create the parm now
                   OracleParameter parm = new OracleParameter(
    paramName
                        , paramType
                        , paramValues.Length == 0 ? (object)DBNull.Value : paramValues
                        , paramDirection);
                   parm.Size = paramSize;
                   parm.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                   if (paramSize != 0)
                        parm.ArrayBindSize = bindArray;
                   else
                   return parm;
    and here is a sample of it being called
                        parmValues = new string[ArrayLen];
                        for (int i = 0; i < parmValues.Length; i++)
                             if (contact.ShippingAddress[i] == null)
                                  parmValues[i] = null;
                             else
                                  parmValues[i] = contact.ShippingAddress[i].ZIP5;
                        parms.Add(BuildAssociativeArray("p_ship_zip_5_code"
                             , OracleDbType.Char
                             , parmValues
                             , 5
                             , ParameterDirection.Input
                             , false));
    Regards,
    Mike

  • How can I pass an empty array to a parameter of type PLSQLAssociativeArray

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

  • Oracle.ManagedDataAccess and ArrayBindSize

    Hello,
    I am trying to upgrade Asp.net web application ODAC 32 bit component  from ODAC 11 to Oracle.MagagedDataAccess. The below code worked fine with ODAC 11 but it throws "System.InvalidOperationException: OracleParameter.ArrayBindSize is invalid" exception when I use ManagedDataAccess
    OracleParameter paramWebRef = new OracleParameter("newwebreference", OracleDbType.Varchar2, 30, new object[order_id_.Count], ParameterDirection.Output); 
    paramWebRef.ArrayBindSize = new int[order_id_.Count].Initialize(30);
    paramWebRef.ArrayBindStatus = new OracleParameterStatus[order_id_.Count].Initialize(OracleParameterStatus.Success);
    Am I missing any other properties or methods which I should use while using Managed DataAccess ?

    i am using parameter array binding and setting the size and status.
                    OracleParameter paramFound = new OracleParameter("found", OracleDbType.Int32, new object[company_id_.Count], ParameterDirection.Output);
                    paramFound.ArrayBindStatus = new OracleParameterStatus[company_id_.Count].Initialize(OracleParameterStatus.Success);
                    paramFound.ArrayBindSize = new int[company_id_.Count()];
    When I run the above lines of code, ExecuteNonQuery not returning any values. Verified the stored procedure using Toad, it returns "1" for the "found" column but in C# code its
    just 0 (OracleDecimal[])paramFound.Value)[i]

  • Array without ArrayBindSize / Size

    Hi All,
    I would like to know how do I get an array of output without having to declare its size before.
    Without using the Size and ArrayBindSize array of return because it may have 10 or 30k positions.
    Thanks,
    Leo.

    Insert array will do what it says, insert an element into the array, AND resize it accordingly.
    If this is not what you want it to do, you should not use Insert Array!
    Instead you would have to do some work of this on your own. The principle would be to allocate a fixed size array in the beginning and maintain how many elements are already in the array. If you now need to insert some data into the array you first move all the data beyond the insertions point by the number of elements that you want to insert. Then copy the data into the array and finally update the bookkeepng about how much data is really in the array. Not as convinient as using a ready made node, but also no rocket science by far.
    There are no out of the box functions that allow to insert data into an array without resizing the array, which is what you want to avoid for the FPGA code.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • PLS-00306:NET to call Oracle stored procedure,Use Array parameters

    Development Environment:Windows 2003 SP2+Oracle 10g
    . NET to call Oracle stored procedure, use an array of types of parameters
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    OR
    CREATE OR REPLACE type string_array is table of nvarchar2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    ODP.NET(Oracle 10g)
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[2] { "11", "222" };
    cmd.ArrayBindCount=2;
    OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p1.Value = str;
    p1.ArrayBindSize=new int[2]{2,3};
    p1.ArrayBindStatus = new OracleParameterStatus[2]{
    OracleParameterStatus.Success,
    OracleParameterStatus.Success
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
    p2.Direction = ParameterDirection.Output;
    P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p2.Value=0;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored

    Hi,
    See the answer in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=909564&tstart=0]
    Hope it helps,
    Greg

  • . NET to call Oracle stored procedure, use an array of types of parameters

    . NET to call Oracle stored procedure, use an array of types of parameters
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    Use System.Data.OracleClient
    C# Code:
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[] { "11", "22" };
    OracleParameter p1 = new OracleParameter("i_test", OracleType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.Value = str;
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleType.Int32);
    p2.Direction = ParameterDirection.Output;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored
    Edited by: user10133982 on Jun 4, 2009 7:13 AM

    . NET to call Oracle stored procedure, use an array of types of parameters
    The use of ODP.net(Oracle 10g), the error is still the same
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    ODP.NET(Oracle 10g)
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[2] { "11", "222" };
    cmd.ArrayBindCount=2;
    OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p1.Value = str;
    p1.ArrayBindSize=new int[2]{2,3};
    p1.ArrayBindStatus = new OracleParameterStatus[2]{
    OracleParameterStatus.Success,
    OracleParameterStatus.Success
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
    p2.Direction = ParameterDirection.Output;
    P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p2.Value=0;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored
    Edited by: user10133982 on Jun 5, 2009 7:48 AM

  • PL/SQL Associative Array as INPUT Parameter

    Hi,
    Just wondering if anyone out there has a good example of how to get VB.NET (using ODP.NET 9.2.0.4) to pass an Associative Array as an Input parameter to a stored procedure (not for bulk binds)? Specifically, I'm looking for an example of how a VB Strong Typed Collection would be passed through the PLSQLAssociativeArray Collection Type.
    I've managed to get a test to work by passing a 1-D String Array through the ODP.NET layer to the PL/SQL AssociativeArray parameter. But I've had zero success trying to get the Collection from VB through ODP.NET.
    Thanks in advance for any help.
    Todd.

    For example, if I wanted to return a list of customer ids and names into A PLSQL Associative Array, how would I do it. I know how to return a list of customer ids into a PLSQL associative aray using the code below but I have to specify the maximum number of elements and the maximum size of each of the elements. Is there any way around this?
    Dim prmOutCustomerIdList As New OracleParameter
    With prmOutCustomerIdList
    .ParameterName = "oCustomerIdList"
    .CollectionType = OracleCollectionType.PLSQLAssociativeArray
    .OracleDbType = OracleDbType.Varchar2
    .Direction = ParameterDirection.Output
    .Size = 5
    .ArrayBindSize = New Integer(4) {10, 10, 10, 10, 10}
    End With

  • Procedure Array Binding a Null Value

    Can you perform array binding in ODP.NET (to a procedure for example that inserts values) and assume that if there are null values in the array that the records inserted will have the corresponding null values in their records?

    Here's a quick sample using pl/sql associative arrays to insert null values into a table (I think this is what you mean)...
    SQL*Plus: Release 10.1.0.3.0 - Production on Fri Feb 18 09:38:55 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    SQL> connect /
    Connected.
    SQL> create table null_array_insert
      2  (
      3    first_name  varchar2(32) not null,
      4    middle_name varchar2(32) null,
      5    last_name   varchar2(32) not null
      6  );
    Table created.
    SQL> create or replace package null_array_test as
      2    -- create a type for each column
      3    type t_first_name is table of null_array_insert.first_name%type
      4      index by binary_integer;
      5
      6    type t_middle_name is table of null_array_insert.middle_name%type
      7      index by binary_integer;
      8
      9    type t_last_name is table of null_array_insert.last_name%type
    10      index by binary_integer;
    11
    12    -- the procedures that will perform our work
    13    procedure bulk_insert (p_first_name  in t_first_name,
    14                           p_middle_name in t_middle_name,
    15                           p_last_name   in t_last_name);
    16  end null_array_test;
    17  /
    Package created.
    SQL> create or replace package body null_array_test as
      2    procedure bulk_insert (p_first_name  in t_first_name,
      3                           p_middle_name in t_middle_name,
      4                           p_last_name   in t_last_name) is
      5    begin
      6      forall i in p_first_name.first..p_first_name.last
      7      insert into null_array_insert (first_name,
      8                                     middle_name,
      9                                     last_name)
    10                          values    (p_first_name(i),
    11                                     p_middle_name(i),
    12                                     p_last_name(i));
    13    end bulk_insert;
    14  end null_array_test;
    15  /
    Package body created.
    Here's the C# code:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    namespace Associative
      /// <summary>
      /// Summary description for Class1.
      /// </summary>
      class Class1
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
          string connStr = "User Id=/";
          OracleConnection oraConn = new OracleConnection(connStr);
          oraConn.Open();
          // create the command object and set attributes
          OracleCommand cmd = new OracleCommand("null_array_test.bulk_insert", oraConn);
          cmd.CommandType = CommandType.StoredProcedure;
          // create parameter objects for each parameter
          OracleParameter p_first_name = new OracleParameter();
          OracleParameter p_middle_name = new OracleParameter();
          OracleParameter p_last_name = new OracleParameter();
          // set parameter type for each parameter
          p_first_name.OracleDbType = OracleDbType.Varchar2;
          p_middle_name.OracleDbType = OracleDbType.Varchar2;
          p_last_name.OracleDbType = OracleDbType.Varchar2;
          // set the collection type for each parameter
          p_first_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
          p_middle_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
          p_last_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
          // set the parameter values
          p_first_name.Value = new string[4]{"First 1", "First 2", "First 3", "First 4"};
          p_middle_name.Value = new string[4]{"Middle 1", "", "Middle 3", ""};
          p_last_name.Value = new string[4]{"Last 1", "Last 2", "Last 3", "Last 4"};
          // set the size for each array
          p_first_name.Size = 4;
          p_middle_name.Size = 4;
          p_last_name.Size = 4;
          // set array bind size for the columns since they
          // are a variable size type (varchar2)
          p_first_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
          p_middle_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
          p_last_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
          // add the parameters to the command object
          cmd.Parameters.Add(p_first_name);
          cmd.Parameters.Add(p_middle_name);
          cmd.Parameters.Add(p_last_name);
          // execute the insert
          cmd.ExecuteNonQuery();
          p_last_name.Dispose();
          p_middle_name.Dispose();
          p_first_name.Dispose();
          cmd.Dispose();
          oraConn.Dispose();
    And after running the code:
    SQL> select * from null_array_insert;
    FIRST_NAME                       MIDDLE_NAME                      LAST_NAME
    First 1                          Middle 1                         Last 1
    First 2                                                           Last 2
    First 3                          Middle 3                         Last 3
    First 4                                                           Last 4
    4 rows selected.
    SQL> select * from null_array_insert where middle_name is null;
    FIRST_NAME                       MIDDLE_NAME                      LAST_NAME
    First 2                                                           Last 2
    First 4                                                           Last 4
    2 rows selected.
    SQL>Hope that helps,
    - Mark

  • Data access via stored procedure - Return type as PLSQLAssociate array

    Hi,
    I get an error as array bind type must match pl/sqldata type when i execute a stored proc.
    My stored proc looks like this:
    PROCEDURE Datasearch
    (p_type in varchar2,
    p_empid in varchar2,
    p_empcode out tempid,
    p_lname out tlname,
    p_fname out tfname,
    p_nickname out tnickname,
    p_position out tposition,
    p_startdt out tstartdt,
    p_status out tstatus,
    p_loastart out tloastart,
    p_loaend out tloaend,
    p_xchange out txchange,
    p_trx out ttrx,
    p_enddt out tenddt,
    p_hfind out thfind)
    is
    ... end Empsearch
    And I am trying to fire this stored proc using the following C# code:
    OracleConnection con = new OracleConnection();
    con.ConnectionString = "ValidConnectionString";
    con.Open();
    Console.WriteLine("Connected to Oracle" + con.ServerVersion);
    string cmdTxt = "begin MyPack.Datasearch(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15); end;";
    OracleCommand myCMD = new OracleCommand(cmdTxt, con);
    //Input params
    myCMD.Parameters.Add("1", OracleDbType.Varchar2).Value = "All";
    myCMD.Parameters.Add("2", OracleDbType.Varchar2).Value = "1129";
    myCMD.Parameters[0].Direction = ParameterDirection.Input;
    myCMD.Parameters[1].Direction = ParameterDirection.Input;
    //Output params
    OracleParameter Param3 = myCMD.Parameters.Add("3", OracleDbType.Int16);
    OracleParameter Param4 = myCMD.Parameters.Add("4", OracleDbType.Varchar2);
    OracleParameter Param5 = myCMD.Parameters.Add("5", OracleDbType.Varchar2);
    OracleParameter Param6 = myCMD.Parameters.Add("6", OracleDbType.Varchar2);
    OracleParameter Param7 = myCMD.Parameters.Add("7", OracleDbType.Varchar2);
    OracleParameter Param8 = myCMD.Parameters.Add("8", OracleDbType.Date);
    OracleParameter Param9 = myCMD.Parameters.Add("9", OracleDbType.Varchar2);
    OracleParameter Param10 = myCMD.Parameters.Add("10", OracleDbType.Varchar2);
    OracleParameter Param11 = myCMD.Parameters.Add("11", OracleDbType.Varchar2);
    OracleParameter Param12 = myCMD.Parameters.Add("12", OracleDbType.Varchar2);
    OracleParameter Param13 = myCMD.Parameters.Add("13", OracleDbType.Varchar2);
    OracleParameter Param14 = myCMD.Parameters.Add("14", OracleDbType.Date);
    OracleParameter Param15 = myCMD.Parameters.Add("15", OracleDbType.Varchar2);
    //test ends
    for (int i = 2; i < 15; i++)
    myCMD.Parameters.Direction = ParameterDirection.Output;
    myCMD.Parameters[i].CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    myCMD.Parameters[i].Value = null;
    myCMD.Parameters[i].Size = 3;
    myCMD.Parameters[i].ArrayBindSize = new int[3] { 20, 20, 20 };
    myCMD.ExecuteNonQuery();
    I get an error on the above ExecuteNonQuery statement..
    Any help/pointer will be highly appreciated.
    -Cheers

    it appears you are not creating the int array correctly (please correct me if I am wrong)
    we've created a helper class to alleviate the need for most of the manual coding, so in a gist:
    param.ArrayBindSize = BindArraysToSize()
    'whereas the collectionObjects is a simple array list containing the values that we intend for our assoc. arry
            Private Function BindArraysToSize() As Integer()
                Dim ArrBindSize(collectionObjects.Count - 1) As Integer
                For i As Integer = 0 To collectionObjects.Count - 1
                    ArrBindSize(i) = collectionObjects(i).ToString().Length
                Next i
                Return ArrBindSize
            End Functionbut for the exact issue you are having; you need to assign the values on the NEW (VS ought to warn you: "The short has no constructors")
    try
                Dim ar(4) As Int16 '= {1, 2, 3, 4, 5}
                For i as Integer = 1 to 5
                   ar(i-1) = i
                Next i
    pStatus.ArrayBindSize = ar
    OR
                Dim ar2 As Int16() = {1, 2, 3, 4, 5}
    pStatus.ArrayBindSize = ar2
    OR
                Dim ar3 As Int16() = New Int16(4) {1, 2, 3, 4, 5}
    pStatus.ArrayBindSize = ar3
    OR
    pStatus.ArrayBindSize = New Int16(4) {1, 2, 3, 4, 5}

Maybe you are looking for

  • No movie playback with video adaptor

    OK, here's a poser... Setting up my Macbook as a temporary AppleTV. Front Row is working perfectly, streaming shared content from my desktop. So long as I am viewing on the Macbook's screen, everything is as it should be. Here's the problem. I connec

  • How can I set up personal hotspot on iPad 3

    How can I set up personal hotspot on iPad 3, I use 3G services from Etisalat  SIM

  • Setting the document language in a pdf for accessibility

    I have created a form in livecycle and ran the full accessiblity check in Adobe and it says that 'All of the text on this page lacks a language specification'. I tried to go into the document properties>advanced and set the reading options but everyt

  • Keyboard Update Won't Recognize My Keyboard

    I have a relatively new (2-battery) aluminum keyboard and magic mouse--and yes, I've had the battery draining problem. Today (Jan 26, 2010) I downloaded the shiny new Aluminum Keyboard Firmware Update. But when I run it I get the message "No aluminum

  • English version of user guide for nokia n77i china...

    can someone please tell me as to where i can get the english version of user guide of the set "nokia n77i china mobile"... please..