Is it possible to pass array of strings as input parameters for stored proc

Dear All,
I wrote a Stored Procedure for my crystal report. now i got a modification.
one of the parameters 'profit_center' should be modified so that it is capable to take multiple values.
now when i run report crystal report collects more than one values for parameter profit_center and sends it as input parameter to stored procedure all at a time.
the only way to handle this situation is the input parameter for stored procedure 'profit_center' should be able to take array of values and i have a filter gl.anal_to = '{?profit_center}'. this filter should also be modified to be good for array of values.
Please Help.

Or you can use sys.ODCIVarchar2List
SQL> create or replace procedure print_name( In_Array sys.ODCIVarchar2List)
    is
    begin
            for c in ( select * from table(In_Array) )
            loop
                    dbms_output.put_line(c.column_value);
            end loop ;
    end ;
Procedure created.
SQL>
SQL> exec print_name(sys.ODCIVarchar2List('ALLEN','RICHARD','KING')) ;
ALLEN
RICHARD
KING
PL/SQL procedure successfully completed.SS

Similar Messages

  • Is it possible to pass table type values as input parameter for con prg?

    Hi All,
    Could you please confirm that is it possible to pass table type value as input to concurrent program?
    If possible how to achive this?
    If not possible whether we have any ora doc which is confirming this.
    Any hel will be great.
    Thanks,

    Hi student;
    Please check (http://apps2fusion.com/at/45-as/241-enablingdisabling-concurrent-program-parameters)
    Hope it helps
    Regard
    Helios

  • Is possible to pass array/list as parameter in TopLink StoredProcedureCall?

    Hi, We need to pass an array/List/Vector of values (each value is a 10 character string) into TopLink's StoredProcedureCall. The maximum number of elements on the list is 3,000 (3,000 * 10 = 30,000 characters).
    This exposed two questions:
    1. Is it possible to pass a Vector as a parameter in TopLink's StoredProcedureCall, such as
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    Vector strVect = new Vector(3000);
    strVect.add(“ab-gthhjko”);
    strVect.add(“cd-gthhjko”);
    strVect.add(“ef-gthhjko”);
    Vector parameters = new Vector();
    parameters.addElement(strVect);
    session.executeQuery(query,parameters);
    2. If the answer on previous question is yes:
    - How this parameter has to be defined in Oracle’s Stored Procedure?
    - What is the maximum number of elements/bytes that can be passed into the vector?
    The best way that we have found so far was to use single string as a parameter. The individual values would be delimited by comma, such as "ab-gthhjko,cd-gthhjko,ef-gthhjko..."
    However, in this case concern is the size that can be 3,000 * 11 = 33, 000 characters. The maximum size of VARCHAR2 is 4000, so we would need to break calls in chunks (max 9 chunks).
    Is there any other/more optimal way to do this?
    Thanks for your help!
    Zoran

    Hello,
    No, you cannot currently pass a vector of objects as a parameter to a stored procedure. JDBC will not take a vector as an argument unless you want it to serialize it (ie a blob) .
    The Oracle database though does have support for struct types and varray types. So you could define a stored procedure to take a VARRAY of strings/varchar, and use that stored procedure through TopLink. For instance:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    oracle.sql.ArrayDescriptor descriptor = new oracle.sql.ArrayDescriptor("ARRAYTYPE_NAME", dbconnection);
    oracle.sql.ARRAY dbarray = new oracle.sql.ARRAY(descriptor, dbconnection, dataArray);
    Vector parameters = new Vector();
    parameters.addElement(dbarray);
    session.executeQuery(query,parameters);This will work for any values as long as you are not going to pass in null as a value as the driver can determine the type from the object.
    dataArray is an Object array consisting of your String objects.
    For output or inoutput parameters you need to set the type and typename as well:
      sqlcall.addUnamedInOutputArgument("PERSON_CODE", "PERSON_CODE", Types.ARRAY, "ARRAYTYPE_NAME"); which will take a VARRAY and return a VARRAY type object.
    The next major release of TopLink will support taking in a vector of strings and performing the conversion to a VARRAY for you, as well as returning a vector instead of a VARRAY for out arguments.
    Check out thread
    Using VARRAYs as parameters to a Stored Procedure
    showing an example on how to get the conection to create the varray, as well as
    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html on using Varrays in Oracle, though I'm sure the database docs might have more information.
    Best Regards,
    Chris

  • Arrays as IN/OUT parameters to stored procs

    I need the ability to pass Java arrays as input parameters and receive arrays as output parameters from stored procedures. I searched this forum for "array stored procedure" and came up with 9 posts dating back to April 30, 1999. In every one of these posts, people have asked how this can be done, and as yet there has not been any real solution provided. One messy solution is to add another stored proc that takes the array items as scalars and builds a PL/SQL table to pass to the original stored proc.
    I am getting the impression that using arrays for IN/OUT parameters to/from stored procedures is not possible with JDK 1.1. Can it be done with JDK 1.2?
    Isn't there anyone from Oracle that can provide an answer or solution?

    I've searched for a way of passing a rowtype to a stored
    procedure or passing an array to a stored procedure.
    The following example may have some pertinence. It was posted at
    http://www.classicity.com/oracle/htdocs/forums/ClsyForumID124/6.h
    tml#
    I also think that it would be useful to know how best to pas a
    ResultSet or equivalent to a Stored Procedure, if someone has
    more information. The idea is to have symmetry between the way
    data is retrieved from SP's (CURSORS) and supplied to SP's (???
    ARRAY/CURSOR) ?
    "[Example]Example of using JDBC with VARRAYS and REF CURSORs"
    This example shows how to use JDBC with VARRAYS and REF
    CURSORs.
    It also shows use of the PreparedStatement and CallableStatement
    methods.
    The example does the follows:
    1. selects from a table of VARRAYs
    2. inserts into a table of VARRAYs
    3. selects from a table of VARRAYs
    4. calls stored procedure -- parameters <ref cursor, varray>
    In order to test it, you will need to do two things first:
    1) Create related tables and types first. The screipt is given
    below.
    2) Create a package that gets called from JAVA code. The script
    is given below.
    ======================= Step 1 create tables etc. cute here
    ==================
    -- Run this through SQL*PLUS
    drop TABLE varray_table;
    drop TYPE num_varray;
    drop TABLE sec;
    -- create the type
    create TYPE num_varray as VARRAY(10) OF NUMBER(12, 2);
    -- create the table
    create TABLE varray_table (col1 num_varray);
    -- create the sec table
    create table sec (sec_id number(8) not null, sec_grp_id number
    (8) not null,
    company_id number(8) not null);
    insert into sec values (1,200,11);
    insert into sec values (2,1100,22);
    insert into sec values (3,1300,33);
    insert into sec values (4,1800,44);
    ==================== End of step
    1===========================================
    ================== Step 2 create package
    ====================================
    -- Run it through sql*plus
    CREATE OR REPLACE PACKAGE packageA AS
    type sctype is ref cursor return SEC%ROWTYPE;
    procedure get_port_consensus(sc IN OUT sctype, arr IN
    num_varray);
    procedure test_port_consensus(sc IN OUT sctype);
    END packageA;
    CREATE OR REPLACE PACKAGE BODY packageA AS
    procedure test_port_consensus(sc IN OUT sctype)
    IS
    testArr num_varray := num_varray(200, 1100, 1300, 1800);
    BEGIN
    get_port_consensus(sc, testArr);
    END test_port_consensus;
    procedure get_port_consensus(sc IN OUT sctype, arr IN num_varray)
    IS
    BEGIN
    open sc for select * from sec
    where sec_grp_id = arr(1)
    or sec_grp_id = arr(2)
    or sec_grp_id = arr(3)
    or sec_grp_id = arr(4);
    END get_port_consensus;
    END packageA;
    ===================== End of step 2
    ===================================
    ============ JAVA code to test the whole thing
    ========================
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.oracore.Util;
    import oracle.jdbc.driver.*;
    import java.math.BigDecimal;
    public class ArrayExample
    public static void main (String args<>)
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver
    // Connect to the database
    // You need to put your database name after the @ sign in
    // the connection URL.
    // The example retrieves an varray of type "NUM_VARRAY",
    // materializes the object as an object of type ARRAY.
    // A new ARRAY is then inserted into the database.
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@v81",
    "scott", "tiger");
    // It's faster when auto commit is off
    conn.setAutoCommit (false);
    // Create a Statement
    Statement stmt = conn.createStatement ();
    System.out.println("Querying varray_table");
    ResultSet rs = stmt.executeQuery("SELECT * FROM varray_table");
    showResultSet (rs);
    // now insert a new row
    // create a new ARRAY object
    int elements<> = { 200, 1100, 1300, 1800 };
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor
    ("NUM_VARRAY",conn);
    ARRAY newArray = new ARRAY(desc, conn, elements);
    // prepare statement to be inserted and bind the num_varray type
    System.out.println("PreparedStatement: Inserting into
    varray_table");
    PreparedStatement ps =
    conn.prepareStatement ("insert into varray_table values (?)");
    ((OraclePreparedStatement)ps).setARRAY (1, newArray);
    ps.execute ();
    // query to view our newly inserted row
    System.out.println("Querying varray_table again");
    rs = stmt.executeQuery("SELECT * FROM varray_table");
    showResultSet (rs);
    // prepare a callable statement -- call the stored procedure
    // passing <ref cursor in out, varray in>
    System.out.println("CallableStatement: Calling Stored
    Procedure");
    OracleCallableStatement oraStmt1 =
    (OracleCallableStatement)conn.prepareCall("{ call
    packageA.get_port_consensus(?, ?) }");
    oraStmt1.registerOutParameter(1, OracleTypes.CURSOR);
    oraStmt1.setARRAY(2, newArray);
    oraStmt1.execute();
    rs = (ResultSet)oraStmt1.getObject(1);
    // loop through the result set of the ref cursor and display
    while (rs.next()) {
    System.out.println(rs.getString("sec_grp_id"));
    // Close all the resources
    rs.close();
    ps.close();
    stmt.close();
    oraStmt1.close();
    conn.close();
    public static void showResultSet (ResultSet rs)
    throws SQLException
    int line = 0;
    while (rs.next())
    line++;
    System.out.println("Row "+line+" : ");
    ARRAY array = ((OracleResultSet)rs).getARRAY (1);
    System.out.println ("Array is of type "+array.getSQLTypeName());
    System.out.println ("Array element is of type
    code "+array.getBaseType());
    System.out.println ("Array is of length "+array.length());
    // get Array elements
    BigDecimal<> values = (BigDecimal<>) array.getArray();
    for (int i=0; i<values.length; i++)
    BigDecimal value = (BigDecimal) values;
    System.out.println(">> index "+i+" = "+value.intValue());

  • Here's how to pass XML as a parameter to an Oracle stored proc

    This, or something like it, should be all over the web and I intend to do so.
    The first sample has exactly what you need in order to pass "XML" as a parm to a stored proc.
    http://www.oracle-base.com/forums/viewtopic.php?f=2&t=8468

    > Really, what is the difference between the 2?
    "What is a...?" questions are easily answered by Google. Generally speaking, however, "JavaScript" is Netscape's implementation of ECMAScript, a scripting language primarily for client-side development for a web browser. "Java" is an entire platform, but typically refers to an object-oriented programming language that is typically compiled to bytecode and run in a virtual machine.
    They're not the same thing at all.
    ~

  • Passing Arrays of User Defined Types to Oracle Stored Procedures

    Hi
    I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
    Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
    Summary of Approach:
    In the Oracle database, we have defined a Object Type :
    CREATE OR REPLACE
    TYPE MYTYPE AS OBJECT
    TxnId VARCHAR2(40),
    Target VARCHAR2(20),
    Source VARCHAR2(20),
    Param1 VARCHAR2(2048),
    Param2 VARCHAR2(2048),
    Param3 VARCHAR2(2048),
    Param4 VARCHAR2(2048),
    Param5 VARCHAR2(2048),
    and we have defined a collection of these as:
    CREATE OR REPLACE
    TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
    There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
    I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
    Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
    Thanks
    Andy

    Andy Bowes wrote:
    Hi
    I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
    Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
    Summary of Approach:
    In the Oracle database, we have defined a Object Type :
    CREATE OR REPLACE
    TYPE MYTYPE AS OBJECT
    TxnId VARCHAR2(40),
    Target VARCHAR2(20),
    Source VARCHAR2(20),
    Param1 VARCHAR2(2048),
    Param2 VARCHAR2(2048),
    Param3 VARCHAR2(2048),
    Param4 VARCHAR2(2048),
    Param5 VARCHAR2(2048),
    and we have defined a collection of these as:
    CREATE OR REPLACE
    TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
    There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
    I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
    Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
    Thanks
    AndyHi. Here's what I suggest: First please get the JDBC you want to work in a
    small standalone program that uses the Oracle thin driver directly. Once
    that works, show me the JDBC code, and I will see what translation if
    any is needed to make it work with WLS. Will your code be running in
    WebLogic, or in an external client talking to WebLogic?
    Also, have you tried the executeBatch() methods to see if you can
    get the performance you want via batches?
    Joe

  • How to pass a CURSOR as an input in a Stored Procedure ?

    Hi all
    I am using Java to work with 2 Oracle DBs, using JDBC.
    I've got a question about using a Oracle Stored Procedure with CURSORs :
    A first stored procedure gets data from the first DB (returns a CURSOR) and I'd like to pass this CURSOR to the second stored procedure as a (Java) IN parameter, so using a "getObject()" then a "setObject()", to insert data from the CURSOR in the second DB.
    This is the theory !
    En reality, the first stored procedure works fine, and returns the cursor, but after that ... I can't even create the second stored procedure. I planed to do something like the following stuff :
    CREATE OR REPLACE PROCEDURE proc_insert_data(cur_ref IN OUT types.ref_cursor) AS
    BEGIN
    LOOP
    FETCH cur_ref INTO FIELD1, FIELD2;
         INSERT INTO TABLENAME VALUES (FIELD1, FIELD2);
    EXIT WHEN cur_ref%NotFound;
    END LOOP;
    END proc_insert_data;
    with a LOOP for each row and then an INSERT.
    But this doesn't seeem to be correct.
    Has anybody an idea to make this stored procedure to work ?
    Thx in advance
    Krystoffff

    Hi Chris,
    When you want to pass a CURSOR to a procedure/function
    you will have to employ a package here. Create a package
    which contains both of your procedures.This package should have a global variable which is of type ref cursor.The IN parameter for the 2nd procedure and the OUT parameter of the first proc should be of type this global cursor var.
    Now you call the first procedure and get the resulting cursor from it, pass it to the second procedure...
    Good luck.
    Regards,
    Madhu

  • XML String as input parm for WS?

    Hi All.
    This has probably been asked and answered a few times, but I can't seem to find a exact answer to my scenario:
    I have a java method that accepts a string as a input parm. However, the string will contain a fully formatted XML string eg:
    <?xml version=\"1.0\" standalone=\"yes\"?>
    <CAMPUS_UPD>
    <MSG_SEQ_NO>NATX_00000000000000200609141569398</MSG_SEQ_NO>
    <EVENT_NAME>CAMPUS_UPD.UPD</EVENT_NAME>
    <STATUSCODE>000</STATUSCODE>
    <CAMPUS_KODE>01</CAMPUS_KODE>
    <CAMPUS_NAME>STELLENBOSCH</CAMPUS_NAME>
    </CAMPUS_UPD>
    I'm basically going to put this XML string directly onto a InterConnect AQ Table for consumption by Interconnect.
    Now naturally I get a VERY strange set of errors when I actually try to call the WS with this XML String.
    <HTML><HEAD><TITLE>Web Service</TITLE></HEAD><BODY><H1>Bad Request</H1><PRE>Error parsing envelope: (4, 30) PI with the name 'xml' can occur only in the beginning of the document.</PRE></BODY></HTML>
    If I remove the first line of the XML string, the error message changes to:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://sun.oic.ws/types/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>caught exception while handling request: deserialization error: unexpected XML reader state. expected: END but found: START: KAMPUS_UPD</faultstring></env:Fault></env:Body></env:Envelope>
    Any Ideas/suggestions/wild speculations/URL's etc.
    Kind Regards
    Elmar Matthee
    University of Stellenbosch
    South Africa

    Hi Eric/all.
    Just thought I'd give a follow up on my progress.
    Got the web services working and finally able to test via Jdev. Seems the problem was with the proxy server settings of jdeveloper itself. I had localhost specified as an ip NOT to use a proxy server for, but when the test code got generated it used the actual ip of my machine (where the application server is also running) to access the web service, and thats where it got stuck.
    I actually sent along the embedded xml string in a string parameter directly to the the web service, and it worked like a charm (as opposed to testing it via the application server administration web page where I had to translate the < and > characters. So quite chuffed with that.
    Today I'm researching a) What happens when you have a complex data type (i.e. a java class containing 3 fields like username/fullname/age) from a web service. When I test it via the application server web page, I get the actual fields with their names and values in an xml type format back, but when I test it via java, i get a reference to the object. Now I could cast the result back into the class definition that I used when creating the web service, but what if I don't know what that is (i.e. someone else somewhere wrote the WS, and I have no idea about implementation)?
    b) related to a) is how to convert the complex data type return value into an XML string before sending the reply (or maybe even a pure String containing the XML data). I.e. instead of sending a Person class, I send back an XML data type containing the relevant data with tags and all. I'm a bit worried about this, because it looks as if the data is alreaddy actually coming back in an XML format, its just that the java test program doesn't see it that way, and I'm loath add the extra overhead if it isn't needed.
    c) related to both a) and b). How the @$#@ does one actually use/call a web service in a simple .jsp page? Seemingly a simple question, but thus far, the answer eludes me. :)
    Any thoughts/comments/ideas/wild speculations/urls welcome.
    Kind Regards.
    Elmar

  • Passing a long string from Vb to stored proc

    Hi,
    I am passing a long string from Vb to this stored proc ..
    defn:
    Create Or Replace Procedure saveTaxFormInDB(intFormUID IN number,
    intCLUID IN number,
    PDFdata IN varchar2,
    Status IN OUT Varchar2) AS
    Problem lies with the string pdfdata. I am sending it from VB as:
    Set cmdParamStr = cmdAdoCmd.CreateParameter("Data", adVarChar,
    adParamInput, 32767, strData)
    I have checked the parameters in VB while sending and I have the
    correct string argument to be passed to "PDFData", But i am not
    sure if it is getting the value correctly.
    Because I know that the code is raising exception while
    accessing PDFData. (eg. in places like insert ..(pdfdata) and
    length(pdfdata)...)
    Please advise how i can solve this problem.
    Please Note that the string is not VERY large. I do not need to
    use LOBS in any way. the string is definitely within the limits
    of varchar2(which i think is 4000 chars.. correct me if i am
    wrong).
    Many thanks

    what is the backend MS SQl server or Oracle.??
    If it is MS SQLSERVER, then
    1.Create a SqlCommand object with the parameters as the name of the stored procedure that is to be executed and the connection object con to which the command is to be sent for execution.
    SqlCommand command = new SqlCommand("Name of StoredProcedure",con);
    2.Change the command objects CommandType property to stored procedure.
    command.CommandType = CommandType.StoredProcedure;
    3.Add the parameters to the command object using the Parameters collection and the SqlParameter class.
    command.Parameters.Add(new SqlParameter("@parametername",SqlDbType.Int,0,"Filedname"));
    4.Specify the values of the parameters using the Value property of the parameters
    command.Parameters[0].Value=4;
    command.Parameters[1].Value="ABC";
    If it is oracle,
    OracleConnection con = new OracleConnection("uid=;pwd=");
    try
    con.Open();
    OracleCommand spcmd = new OracleCommand("Name of StoredProcedure");
    spcmd.CommandType = CommandType.StoredProcedure;
    spcmd.Connection = con;
    spcmd.Parameters.Add("empid", OracleType.Number, 5).Value = txtEmpid.Text;
    spcmd.Parameters.Add("sal", OracleType.Number, 5).Value = txtSal.Text;
    spcmd.ExecuteNonQuery();
    }

  • How to pass array into xslt from java

    i have a xslt in which i am passing some parameter from java there is one parameter which is a array in java which i need to pass becouse array length is not defined so that xslt will work dynakically according to the parameter.
    right now i am passing parameter but not able to send the array parameter that's why my code is not fully dynamic
    please give suggestion.
    anagh

    it is not possible to pass array by using XSLT, you can wirite all values into a String with certain delim symbol, pass this string, then use xsl.substring() to get different values.

  • Passing array of timestamps into oracle stored proc

    Hey there,
    I have an interesting problem. I need to pass an array of java.sql.Timestamp into a stored proc.
    I see that the PreparedStatement provides a setArray() method which takes as arguments an int, java.sql.Array
    Anybody know how I can use the java.sql.Array to my advantage here ? Basically, I don't see how I can create a java.sql.Array of Timestamps
    thanks in advance for all your help.
    Manish Mandelia

    The java.sql.Array implementation is provided by your jdbc driver.
    For exemple using Oracle you can obtain an sql.Array with something like this :
    Connection con=getConnection() // get a connection to the DB
    //first declare what type of array you will use in the DB
    // you probably want to replace CHAR(7) by Timestamp here
    PreparedStatement createArray=
    con.prepareStatement("CREATE OR REPLACE TYPE MYARRAY AS VARRAY(100) OF CHAR(7)");
    createArray.execute();          
    //then get an java instance of this Array
    oracle.sql.ArrayDescriptor arrayDescriptor = oracle.sql.ArrayDescriptor.createDescriptor("MYARRAY",con);
    // content is used to fill the Array
    String[] content= {"string0", "string1"};
    java.sql.Array sqlArray=new oracle.sql.ARRAY(arrayDescriptor, con, content);               
    // then call your stored procedure
    java.sql.CallableStatement callStmt=con.prepareCall("call MyStoredProcedure(?)");
    // passing the array as an argument
    callStmt.setArray(1,sqlArray);
    callStmt.execute();
    As you can see the code is quite database specific.
    hope that helps.

  • Passing arrays to methods?

    Hi all,
    Thanks to most of the main contributors in this forum nearly all of my major hurdles in transitioning from proc-C to Cocoa have been overcome. However, while I was shown how to use NSMutableArray in conjunction with NSDictionary to do pretty much the same job as a C-style multi-dimensional array, dictionaries aren't always the perfect solution in every situation. So, let's suppose I wanted to construct a pure Cocoa facsimile of a C-style [4][x] array like this...
    NSArray *replicaArray = [NSArray arrayWithObjects:
    [NSNull null], // index 0 (unused)
    [NSMutableArray array], // index 1
    [NSMutableArray array], // index 2
    [NSMutableArray array],nil]; // index 3
    I threw in an NSNull as the first array object because (whenever possible) I adopted the habit of leaving row0 and column0 of multidimensional arrays unused to make for more natural, readable iteration ops and stuff. The above code works perfectly well, but with 4-5 different arrays in the same proc-C apps I often had to pass them to common functions (to handle things like bubble-sorting etc.) like the one below:
    void bubbleSortSimpleArray (short arry[ ], short numsToSort)
    short ctr,loopCtr,storeValue;
    for (loopCtr = 1; loopCtr <= numsToSort; loopCtr++)
    ctr = 1;
    while (ctr < numsToSort)
    if (arry[ctr] > arry[ctr+1])
    storeValue = arry[ctr+1];
    arry[ctr+1] = arry[ctr];
    arry[ctr] = storeValue;
    ++ctr;
    Of course, thanks to the advantages of Cocoa this entire code block can be replaced in just a couple lines with 'sortUsingSelector'. Sorry for the lengthy outline in attempting to describe my problem as clearly as possible , but (finally) _is it possible to pass arrays to methods_ in our Cocoa code in a similar way? I was thinking something along the lines of:
    - (void)doMoreProcessing:(id)array
    //do some other common stuff on my array(s) here...
    That'd simplify converting some of my old code and be a real bonus for me, but I haven't been able to find any reference about this on the net so far, and experimenting with my code hasn't provided me with any answers yet, either... Any guidance on this would be very much appreciated!
    Thanks in advance.
    Ernie

    Hi Bang A. Lore,
    Thanks for your input but I've got it figured out now However, while you quite correctly say:
    Pointers work the same way as they do in C.
    the cause of my problems wasn't a lack of understanding of pointers, but by the syntax differences between proc-C and obj-C. I'm well aware of the fact that the name of a passed array is just a pointer to its address in memory of course, but attempting to use a mandatory 'C' style header declaration along the lines of:
    - (void)test2DArray:(NSMutableArray*)array[][];
    just kept giving me parse errors, as did any attempt to use square brackets in the implementation file. While 'C' insists on using them, I found (after some more experimentation) that obj-C will quite happily accept:
    - (void)test2DArray:(NSMutableArray*)array;
    ...or the even simpler...
    - (void)test2DArray:(id)array;
    Also pleasantly surprised to find that Cocoa doesn't seem to give a hoot whether the (array) object you pass it is flat OR multidimensional -- whereas 'C' insists you even provide the called function with the number of rows contained in a multi-subscripted array -- which often meant I had to include two versions of many functions containing identical code, depending on whether they were called by 1D or 2D arrays.
    Once I hit on the idea of omitting the square brackets entirely (just to stop the darned parse errors and see what would happen out of curiosity), the problem just went away.
    Thanks once again. Appreciate it!

  • Passing array to stored proc as parameter

    Hi,
    I want to pass an array from my .Net application to oracle as a parameter to one of my stored proc. The signature of my SP looks like.
    SP_Name(counter int, table_name varchar, log_values logs)
    --(where logs is a varray of type varchar(100)
    How can i pass an array of logs from .Net to this stored proc using ODP.Net?
    Please help.

    You should have an example on your hard drive in
    %OracleHome%\ODP.NET\samples\AssocArray
    Cheers

  • BizTalk Stored Proce-passing XML as one of the Input parameter and String as another parameter

    I have a requirement in BizTalk that
    - I will receive XML from Source and i need to submit this XML data and two other string parameters in  SQL storeprocedure  as a parameters and submit data
    Ex: My_SP(myID Integer INPUT,myXML xml Input,mystring OUT)
    Could you please help me how call storeprocedure and submit multiple parameters in BizTalk.

    you can execute stored procedure by generating schemas from WCF-SQL Adapter.
    for passing parameters you will have to do the mapping to the Generated schema for Stored proc.
    I would suggest to do this in Message Assignment shape, there you can easily assign all the parameters.
    Integer and String parameters can be assigned from normal variables and XML parameter can be inserted as suggested by Abhishek-
    xmldoc=requestMsg;
    varOuterstring=xmldoc.Outerxml.Tostring();
    Please refer the below article.
    https://www.packtpub.com/books/content/new-soa-capabilities-biztalk-server-2009-wcf-sql-server-adapter
    http://msdn.microsoft.com/en-us/library/dd787968.aspx
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Is it possible to pass an xml from external system to EBS using BE

    Hi All,
    Is it possible to pass the xml payload as input parameter of a function subscribed to Business event? Or is it possible to pass table type as input to BE subscription function (SRF)? if yes how?
    Thanks,

    Workflow Business Events help creating Generate Function to generate an XML payload that in turn is made available to the Subscription's Rule Function. Also, at the time of Raising the Business Event, you could pass the XML payload (in the form of a CLOB) to the Raise API that will be passed along to the Business Event's Subscription Rule Function.
    Hope this helps.
    Vijay

Maybe you are looking for

  • MacBook Pro + Snow Leopard + SIL3131 1.1.11 driver still no go!  Help

    Folks I have a unibody MacBook Pro (with access to the battery), Snow Leopard fully updated, a Rosewill RC-605 2 port eSATA II Express Card, and the latest [air quotes] working SIL3132 1.1.11 driver and I still get kernel panics. I've ried other driv

  • NOTE TO EVERYBODY

    BECAUSE ADOBE CANT PROVIDE SUPPORT .... there are fraud people that might trick you under the same name ADOBY SYSTEMS 24x7 support. And thats exactly what is happening here. ADOBE the Fu****CK with links and chat with cheap labor.  BE EXTREMELY CAREF

  • HT1212 Ipad Mini Frozen

    M Ipad mini is frozen and holding the home and lock button do not fix it.  Also not able to connect with itunes to restore it as the message indicates the ipad is lock but it's really frozen.  It will not respond to anything-help

  • JCA installation issues

    We want to use the kodo JCA resource adapter. I have now been through installing it on jboss 4 and websphere 6, trying to make it work. I have run into the following: 1. Kodo.rar need the jdo-1.0.2.jar available. This is so on both jboss and webspher

  • Macbook Pro Retina Display hdmi sound out.

    Hi everyone, Does the MBP Retina have hdmi/sound out? When I connected it to my HDTV the image was ok, but there wasn't any sound on my sound system. The only sound was through the mac's speaker's. Is there any way to solve this problem? Cheers,