Swapping values in an array of type Node

I have a simple class called Node that is storing integers and from this class I am creating an array:
public class Node {
private int iData;
public Node(int key)
iData = key;
public int getKey() {
return iData;
public void setKey(int id) {
iData = id;
} When I insert an integer into the array, I need to be able to look to the previous value and swap it if necessary so that for each insert the smallest number is always the first element.
The problem is that I keep getting "Incompatible Type" errors. I know the solution is very simple, but no matter what I try I keep getting this error.
//assume array has already been created
int temp = array[numOfNodes -1].getKey();
array[numOfNodes -1] = array[numOfNodes];
array[numOfNodes].setKey(temp); I understand why this is wrong, since temp is an integer and the value should be of type Node, but I do not know how to do this correctly.
Thanks
Edited by: jaden403 on Sep 22, 2007 1:17 PM
Edited by: jaden403 on Sep 22, 2007 1:17 PM

do not know how to do this correctly.
import java.util.Random;
public class IntNodeTest {
    public static void main(String[] args) {
        Random rand = new Random();
        int range = 20;
        int size = 5;
        IntNode[] nodes = new IntNode[0];
        for(int j = 0; j < size; j++) {
            nodes = addNode(new IntNode(rand.nextInt(range+1)), nodes);
        showArray(nodes);
    private static IntNode[] addNode(IntNode node, IntNode[] nodes) {
        // Make a new array to receive the new element.
        IntNode[] temp = new IntNode[nodes.length+1];
        // Copy the existing array into temp.
        System.arraycopy(nodes, 0, temp, 0, nodes.length);
        // Assign node to the last element in temp.
        temp[nodes.length] = node;
        return temp;
    private static void showArray(IntNode[] nodes) {
        for(int j = 0; j < nodes.length; j++) {
            System.out.print(nodes[j].getKey());
            if(j < nodes.length-1)
                System.out.print(", ");
        System.out.println();
class IntNode {
    private int iData;
    public IntNode(int key) {
        iData = key;
    public int getKey() {
        return iData;
    public void setKey(int id) {
        iData = id;
}

Similar Messages

  • Rookie Question: Swap values? Declare an array and values of its indices?

    Hello,
    I hope this is the right forum: I have a simple Java Problem but i do not get it.
    Is like that: I have to swap values within an array e.g i have one array with 3 indices. Indice 0 (the first indice) has value 12. The middle indice has no value, and the second indice has value 9. How to swap 9 to 12 and 12 to 9 without direct swap, in other words, by using the middle indice that has no value or is zero? And how do i write it in an array?
    My other questions: How do i Declare an array and values of its indices?
    I hope this is the right forum or site at all, in cas enot, i hope you still can help or give me links that could help. I really need this.

    Hi Rookie,
         http://forum.sun.com is the best place to get answers for your queries.
         Answer to you first question:
         array[0]=array[0]+array[2]; // array[0] will have 21, because 9+12.
         array[2]=array[0]-array[2]; // array[2] will have 9, because 21-12.
         array[0]=array0]-array[2];  // array[0] will have 12, because 21-9.   
         Hope your first query is resolved.
         I will answer your next query in my next reply.
    Thanks & Regards,
    Charan.  

  • Store XML node value into an array with node element name

    Hi,
    I have the following code that displays the node element with the
    corresponding node value. I want to store the values in an array in
    reference to the node name.
    i.e.
    XML (my xml is much bigger than this, 300 elements):
    <stock>
    <symbol>SUNW</symbol>
    <price>17.1</price>
    </stock>-----
    would store the following:
    *data[symbol] = SUNW;*
    *data[price] = 17.1;*
    Thanks in advance,
    Tony
    test.jsp
    Here's my source code:
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="dombean.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="dombean.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%! private void traverseTree(Node node,JspWriter out) throws Exception {
    if(node == null) {
    return;
    int type = node.getNodeType();
    switch (type) {
    // handle document nodes
    case Node.DOCUMENT_NODE: {
    out.println("<tr>");
    traverseTree
    (((Document)node).getDocumentElement(),
    out);
    break;
    // handle element nodes
    case Node.ELEMENT_NODE: {
    String elementName = node.getNodeName();
    //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
    //out.println("</tr>");
    out.println("<tr><td>"+elementName+"</td>");
    NodeList childNodes =
    node.getChildNodes();     
    if(childNodes != null) {
    int length = childNodes.getLength();
    for (int loopIndex = 0; loopIndex <
    length ; loopIndex++)
    traverseTree
    (childNodes.item(loopIndex),out);
    break;
    // handle text nodes
    case Node.TEXT_NODE: {
    String data = node.getNodeValue().trim();
    //if((data.indexOf("\n")  <0) &#38;&#38; (data.length() > 0)) {
    out.println("<td>"+data+"</td></tr>");
    %>
    </table>
    </body>
    </html>
    {code}
    *MyDomParserBean.java*
    Code: package dombean;
    {code:java}
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class MyDomParserBean
    implements java.io.Serializable {
    public MyDomParserBean() {
    public static Document
    getDocument(String file) throws Exception {
    // Step 1: create a DocumentBuilderFactory
    DocumentBuilderFactory dbf =
    DocumentBuilderFactory.newInstance();
    // Step 2: create a DocumentBuilder
    DocumentBuilder db = dbf.newDocumentBuilder();
    // Step 3: parse the input file to get a Document object
    Document doc = db.parse(new File(file));
    return doc;
    {code}
    Edited by: ynotlim333 on Sep 24, 2007 8:41 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:44 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:45 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I still need to store it in an array because its 300 elements in the XML stocks.
    I've done the following but its not working, i'm getting error codes. I think its an easy fix. I'd also like to pass a String instead of a .xml document b/c my xml is stored inside a DB. Any suggestions on that?
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="org.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="org.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%!
            public String element_store = null;
            public String[] stock_data = new String[400];
            private void traverseTree(Node node,JspWriter out) throws Exception {
            if(node == null) {
               return;
            int type = node.getNodeType();
            switch (type) {
               // handle document nodes
               case Node.DOCUMENT_NODE: {
                 out.println("<tr>");
                 traverseTree
                 (((Document)node).getDocumentElement(),
                 out);
                 break;
              // handle element nodes
              case Node.ELEMENT_NODE: {
                String elementName = node.getNodeName();
                element_store = elementName;
                 //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
                   //out.println("</tr>");
                 NodeList childNodes =
                 node.getChildNodes();     
                 if(childNodes != null) {
                    int length = childNodes.getLength();
                    for (int loopIndex = 0; loopIndex <
                    length ; loopIndex++)
                       traverseTree
                       (childNodes.item(loopIndex),out);
                  break;
               // handle text nodes
               case Node.TEXT_NODE: {
                  String data = node.getNodeValue().trim();
                  if((data.indexOf("\n")  <0) && (data.length() > 0)) {
                  out.println("<tr><td>"+element_store+"</td>");
                  out.println("<td>"+data+"</td></tr>");
                  stock_data[element_store]=data;
    %>
    </table>
    </body>
    </html>

  • Type defined array of clusters for holding configuration data - setting default values for each array element

    Hi,
    I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.
    The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  
    I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?
    I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.
    To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.
    Solved!
    Go to Solution.
    Attachments:
    CM_AnalogInputs.ctl ‏11 KB

    Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Error BEA-382510 bad value for type node

    Hi,
    We have a requirement to read the xpath from the resource file placed in project folder in OSB and use that xpath to generate the report. For this I have done the following:
    1) Made the xpath entry to properties file as <xpath>$body/*/*/EMPTYPE/EMPDATA/EMPNO</xpath>
    2) Created a variable to fetch the xpath value from property file, say xpathvar
    3) Created another variable, say reportvar which will have the contents: <report>{$xpathvar/text()}</report>. This should fetch the xpath from the variable and replace it in the calling part to fetch the value of the xpath.
    4) For report generation the in key value it is ./text() from variable reportvar.
    When I test this it throws error:
    <con:errorCode>BEA-382510</con:errorCode>
    <con:reason>
    OSB Assign action failed updating variable "reportxpath": com.bea.wli.common.xquery.XQueryException: Error parsing XML: line 1, column 19: {err}XP0006: "$body/*/*/EMPTYPE/EMPDATA/EMPNO ({http://www.w3.org/2001/XMLSchema}string)": bad value for type node
    </con:reason>
    Any pointers will be highly appreciated.
    Thanks!

    I think you cant substitute xpath as you have did.
    As shown in the blog which you mentioned in the other post you may need to have a xslt transformation with xalan:evaluate to correctly process the xpath read from the properties file.
    <report>{$xpathvar/text()}</report>. Here $xpathvar having the value '$body/*/*/EMPTYPE/EMPDATA/EMPNO' will be treated as string type (this will be string as you have read from the properties file as string) and not node. And you are trying to apply the text() function on a string instead of node which is resulting in that error.

  • Get distinct values from plsql array

    Hi,
    I have declared a variable as below in plsql proc.
    type t_itemid is table of varchar2(10);
    inserted set of items in to this using a program
    now i want distinct values from that array how can i get it.

    I am using 9i so i cannot use set operator and more over my problem is that i am declaring the variable inside the plsql block . when i tried i am getting the below errors:
    SQL> r
    1 declare
    2 type t_type is table of varchar2(10);
    3 v_type t_type;
    4 begin
    5 v_type := t_type('toys','story','good','good','toys','story','dupe','dupe');
    6 for i in (select column_value from table(v_type)) loop
    7 dbms_output.put_line(i.column_value);
    8 end loop;
    9* end;
    for i in (select column_value from table(v_type)) loop
    ERROR at line 6:
    ORA-06550: line 6, column 41:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 6, column 35:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 6, column 10:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 7, column 22:
    PLS-00364: loop index variable 'I' use is invalid
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored

  • Finding a minimum value in an array without using loops

    I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop
    Here is what I have using a loop:
    // This method searches for the minimum value in an array
    public static int min(int a[]){
    int min = a[0];
    for(int i = 1; i < a.length; i++){
    if(a[i] < min){
    min = a;
    return min;
    How do I covert this to do the same thing, using no loops?
    Thank you for replies
    Edited by: kazmania on Feb 7, 2008 12:26 PM

    public class Test112 {
    public int recurse(int[] x, int i, int n)
    if (i==x.length-1) { return (x[i] < n) ? x[i] : n; }
    n = (n < x[++i]) ? n : x;
    return recurse(x, i, n);
    public static void main(String[] args) {
    int[] nums = {3, 1, 56, 2, 99, 34, 5, 78, -400, 2383, 201, -9, -450};
    Test112 t = new Test112();
    int min = t.recurse(nums, 0, nums[0]);
    System.out.println(min);

  • Assigning a value to an array cell populated [BULK]

    Hi all,
    I've got a problem in assigning a value to an array populated with BULK COLLECT INTO .
    I can reproduce the problem with this
    CREATE TABLE TEST_TABLE (
    value1 NUMBER,
    value2 NUMBER
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);And this is the PL/SQL anonymous block that gives me problems:
    DECLARE
      SUBTYPE t_rec IS TEST_TABLE%ROWTYPE;
    TYPE records_table IS TABLE OF t_rec;
      elist RECORDS_TABLE;
      CURSOR table_cursor IS SELECT * FROM TEST_TABLE WHERE rownum <= 20;
    BEGIN
      OPEN table_cursor;
      FETCH table_cursor BULK COLLECT INTO elist;
        FOR j IN 1..elist.COUNT
        LOOP
          elist(j)(1) := elist(j)(1) +1;
        END LOOP;
      CLOSE table_cursor;
    END; The error is
    ORA-06550: line 13, column 7:
    PLS-00308: this construct is not allowed as the origin of an assignment
    ORA-06550: line 13, column 7:
    PL/SQL: Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:So it doesn't compile because of this line of code:
    elist(j)(1) := elist(j)(1) +1;
    Why doesn't it work?
    If I try to do this, works perfectly:
    DECLARE
    TYPE v_num_table
    IS
      TABLE OF NUMBER;
    TYPE v_2_num_table
    IS
      TABLE OF v_num_table;
      v_nums V_2_NUM_TABLE := V_2_NUM_TABLE();
    BEGIN
      v_nums.EXTEND;
      v_nums(1) := v_num_table();
      v_nums(1).EXTEND;
      v_nums(1)(1) := 1;
      v_nums(1)(1) := v_nums(1)(1) +1;
      dbms_output.put_line(v_nums(1)(1) );
    END;Edited by: user10396517 on 2-mar-2012 2.35

    Variable "elist" is a collection of record, so you access an individual field of a given collection element by specifying the field name, not its position :
    DECLARE
      SUBTYPE t_rec IS TEST_TABLE%ROWTYPE;
      TYPE records_table IS TABLE OF t_rec;
      elist RECORDS_TABLE;
      CURSOR table_cursor IS SELECT * FROM TEST_TABLE WHERE rownum <= 20;
    BEGIN
      OPEN table_cursor;
      FETCH table_cursor BULK COLLECT INTO elist;
        FOR j IN 1..elist.COUNT
        LOOP
          elist(j).value1 := elist(j).value1 + 1;
        END LOOP;
      CLOSE table_cursor;
    END;Your second example is different as you're dealing with a collection of collections.

  • What is the maximum rows allowed in PLSQL array table type?

    Hi,
    I have a procedure and it contains the cursor which will fetch more than 500 records. And i have 5 output parameters to store the values coming from the cursor. I don't want to store that into custom table. I want to save it one table type array or something like that. Now i want to know what is the maximum storage of array table type? If i store more than 500 data, how will be the performance? Then is there any other way to achieve this? And that should not decrease the preformace.Let me know your thoughts.
    Thanks

    It really depends on what you are planning to do with the records once you return them from your stored procedure, and what client is on the receiving end of the results.
    One option would be to just return a ref cursor and let the client deal with retreiving the rows themselves, whether one by on or by a bulk collect. Another option would be to declare a table of records matching the result set and do a bulk collect into that table type in your procedure and return the table type to the caller. You could also declare a table type for each field in the resultset, bulk collect the records into thos types and return one for each field.
    Personally, I would likely go with returning a ref cursor. Both of the collect the resultset in your procedure and then return collections to the caller methods require memory on the database server to hold the entire resultset and memeory on the client to hold the entire resultset. While 500 records is probably not going to be too bad on memory, if the result set grows, you will run into memory issues at some point.
    John

  • How to use array or type in "IN" criteria

    Hi all,
    anybody knows how to use group of same datatype data ( array or type ) in SQL statement
    For example
    ls_dept[1] = 'abc';
    ls_dept[2] = 'xyz';
    ls_dept[10] = 'ppr';
    i want to use this group of data in "IN" criteria like
    Select * from department where dept in ('abc','xyz'.....''ppr');
    if anybody know how to use please reply me as soon as possible.
    Thanks,

    I hope you are not suggesting concatenating literals from a web front-end application ;) Is it not what he was saying.. he is getting user input info from an application.. if the user sends multiple values.. he has to build a string with concatenating literals..
    correct me if I am wrong.

  • How to set values to the structure containing a node with cardinality 0..n

    Hello.
    I 'm trying to set values for the node with cardinality 0..n. The node type is "Fields".
    <xsd:complexType name="Field">
       <xsd:sequence>
          <xsd:element name="fieldCode" type="xsd:string"></xsd:element>
          <xsd:element name="displayValue" type="xsd:string" minOccurs="0"></xsd:element>
       </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Fields">
       <xsd:sequence>
          <xsd:element name="field" type="tns:Field" minOccurs="0" maxOccurs="unbounded"></xsd:element>
       </xsd:sequence>
    </xsd:complexType>
    I  need to set several values for the element "fieldCode" but it has cardinality 0..1 and BPM does not allow it but I did not find any option about how to set values for the structure of type "Fields". Could you help me?
    Best regards,
    Timur Semenchuk

    Hi Marcus,
    If there is no way you could change the cardinality of the node, and thus it can contain 0..n items, I think you should create-and-add a new element programmatically.
    Since the collection can contain zero elements, I would add a 'new' button, which upon clicking adds one new element via:
    IYourNodeElement yourNodeElem = wdContext.nodeYourNode().createYourNodeElement();
    wdContext.nodeYourNode().addElement(yourNodeElem);
    Hope this explains a bit!
    Best,
    Robin van het Hof

  • Call Type node not setting Call Type Dynamically By name.

    I'm attempting to use the Call Type node to set a Call Type dynamically by name using the following logic:
    concatenate("somestring_",userParseFromVXML("CT"),"_Q")
    The userParseFromVXML is a custom function that works correctly and pulls my data out of FromExtVXML correctly.  If I use a peripheral variable and use the same logic then set the Call Type node to set the call type dynamically by name using the peripheral variable it sets the call type correctly without any problems.  I'm using UCCE 9.0.3 and I'm wondering if anyone else has run across this issue.

    I wish I'd known about the table function before myself.
    This is what my experience is now after having tested these scenarios.
    Scenario
    Example
    PASS/FAIL
    String literal
    concatenate("somestring_", "test", "_Q")
    PASS
    Peripheral Variable
    concatenate("somestring_", Call.PeripheralVariable1, "_Q")
    PASS
    Custom Function
    concatenate("somestring_", userParseFromVXML("CT"), "_Q")
    Passing now (not sure what i must have been missing)
    The custom function I'm using returns a string and when I created a new custom function returning a String literal it worked just fine.  After doing my testing and swapping back to my original custom function I started seeing the call tagged with the correct Call Type, so I can only assume that I was missing something in the original concatenate string.  The custom function I am using is as follows:
    if((find(%1%,Call.user.microapp.FromExtVXML[0]))>0,before(";",after(concatenate(%1%,"="),Call.user.microapp.FromExtVXML[0])),if((find(%1%,Call.user.microapp.FromExtVXML[1]))>0,before(";",after(concatenate(%1%,"="),Call.user.microapp.FromExtVXML[1])),if((find(%1%,Call.user.microapp.FromExtVXML[2]))>0,before(";",after(concatenate(%1%,"="),Call.user.microapp.FromExtVXML[2])),if((find(%1%,Call.user.microapp.FromExtVXML[3]))>0,before(";",after(concatenate(%1%,"="),Call.user.microapp.FromExtVXML[3])),"Not Found"))))

  • How can I reset the value of an array?

    How can I reset the value of an array at the beginning of my program?

    There is a option in LV,
    "Edit --> Make current value defult"
    Every time you reopen your VI, it will set to your custom default value.
    There are many ways of doing this.
    Another way of doing this is, You can use "sequence structure and property node". Make the property node of your array and choose "value". Then mark it to write. See attach.
    When you feel sad, laugh
    Attachments:
    x.GIF ‏4 KB

  • . 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

  • Setting Values in an Array of Clusters via COM

    Hello everybody,
    I need some help concerning LabView and COM (ActiveX).
    I'm working on NT 4.0 with LabView 5.1 and I've written a COM-Client in Visual
    C++ 6.0 which controls LabView.
    I can set the values of normal Controls, Arrays and Clusters.
    But I'm not able to set values for an array of clusters.
    Does anybody know how to do this ?
    Or is it impossible ?
    Many thanks in advance,
    Ralf Erdmann

    >> I need some help concerning LabView and COM (ActiveX).>> I'm working on
    NT 4.0 with LabView 5.1 and I've written a COM-Client in Visual>> C++ 6.0
    which controls LabView.>> I can set the values of normal Controls, Arrays
    and Clusters.>> But I'm not able to set values for an array of clusters.>>
    Does anybody know how to do this ?>> Or is it impossible ?>> >>With no more
    information, the my answer is, I'm not sure. It is generally>possible to
    set controls by constructing a matching Variant. Make the>array a safe-array,
    the cluster a safe-array, and the elements of the>cluster be variants of
    compatible types to what is in the array.>>If you can't get it to work from
    this, you may want to include the>LV datatype in an email and contact support.>>
    Please allow
    me to get more precise.
    For my testings I used a cluster with just one element (type double)
    in an one-dim array with just this cluster as only element.
    A LV-Cluster is represented as an array of variants in COM.
    So I have an array of arrays. With an array beeing no datatype
    I don't know how to put an array into an array to
    construct a variant to pass to LV.
    How can I solve this?
    Thanks for help.
    Ralf Erdmann

Maybe you are looking for

  • 'peek' Glance on my 928 doesn't work

    I just recently noticed that the peek glance screen isn't working for me any longer. When I turn the screen off with the button, then the glance screen shows the time. But after a few minutes, it goes away (as expected.) If I put my hand over the pho

  • [Solved] Permission denied for imgs in apache home folder

    Hi, I'm getting 403 error when trying to open a captcha image with the browser (generated by codeigniter PHP framework  with captcha helper and Tank Auth library) the imgs are created with the http owner with permission "-rw-r--r--" inside a captcha

  • Internal Order: Approval Routes

    Good morning, We use internal orders in our company, on purchase orders and for goods issue. However, we are looking for more control on the usage of these internal order numbers as users have been coding things incorrectly and we have to make manual

  • Getting a SQL exception when trying to coonet to SQL2000.

    Hi, I am getting the follwoing error when I run my Jrun on the server. My application is trying to talk to IPC(Internet Pricing COnfiguration) using TDS Driver. Now we upgraded the server to MSSQL2000 and OS as Window2000. here is the error. com.sap.

  • JDBC 10g - Support for TNS name entries

    Hello, I found the following statement: JDBC-Thin support for TNSNAMES.ORA Lookup: similar to JDBC-OCI, both client-side and server-side JDBC-Thin can now read the local TNSNAMES.ORA file to resolve service name or TNS alias. Consequently Java in the