Passing in arrays into pl/sql process

I have a package defined as such:
MYPACKAGE_PKG.ASSIGNDESTINATIONS(p_destinations IN destination_array, p_user IN user_array);
The two multiselect apex items are
P103_DESTINATIONS
P103_USERIDS
the non-array call would be like this
MYPACKAGE_PKG.ASSIGNDESTINATIONS(p_destinations => :P103_DESTINATIONS ,
p_user => :P103_USERIDS);
I just don't know how to input the arrays...any help would be appreciated.

Something more like this would work - I put the procedure in the declare b/c i was too lazy to compile one-
DECLARE
  destination_varray apex_application_global.vc_arr2;
  userid_varray      apex_application_global.vc_arr2;
  PROCEDURE do_something(p_destination IN apex_application_global.vc_arr2,
                         p_users       IN apex_application_global.vc_arr2) IS
  BEGIN
    FOR i IN 1 .. p_destination.COUNT LOOP
      dbms_output.put_line(p_destination(i));
    END LOOP;
    FOR j IN 1 .. p_users.COUNT LOOP
      dbms_output.put_line(p_users(j));
    END LOOP;
  END do_something;
BEGIN
  destination_varray := apex_util.string_to_table('HAWAII:CHICAGO:NEW YORK');
  userid_varray      := apex_util.string_to_table('JOHN:CHRIS:MIKE');
  do_something(P_DESTINATION => destination_varray, P_USERS => userid_varray);
END;

Similar Messages

  • Passing a string into an SQL query IN statement

    Hello,
    I need to connect to a database to pull some data to dynamically create a form based on the data I pull back. My SQL query works fine when I manually run it through a SQL client tool, but when I try to pass it through my workflow I'm having trouble with passing my string into the IN part of the statement. So if for example my SQL query is:
    SELECT Field1, Field2, Field3 FROM Table1 WHERE Field4 IN (?)
    I have a process variable that has the string I'm trying to pass into the ?, but I don't seem to be able to get the query to run. I have tried setting up my query to run as a Parameterized Query (passing my string process variable into the ?), and by setting the query up through xPath (where I am calling my process variable with an xPath declaration), but am not having any luck.
    The process variable I am trying to pass is formatted such that I'm passing 'Value1','Value2','Value3' but I can reformat this string if need be. Even with using test data I can't get the query to return anything. For test data I have tried: 'Value1','Value2','Value3' ; Value1','Value2','Value3 ; Value1,Value2,Value3 but the query never returns any data. I can't seem to see how to format the string to pass into the query. The Query will work with a single Value in the test data, but as soon as I try to pass multiple values within the string it fails. Any suggestions?

    The problem looks to be a limit on what I can pass into the SQL query component. My string is coming from data returned from another database. I take the xml output from that database call, pass it through a set variable component to remove my xml tags from the string, and then format the string in a script component (I have to do it this way because of the way the data coming out of my first database call). I've put in loggers, and can see that the string I'm passing into my query that is giving me problems, is formatted the same way as if I were to use the concat function Scott listed above. It looks like there is a limitation on what can be passed in my variable. I have tried creating my entire SQL query statement in a set variable component, and then just calling the process variable that holds that statement, but there is a character limit of 128 character for what can be passed in a variable through xpath in the SQL query component.
    The next thing I tried was changing my SQL where clause. Instead of passing my variable directly into the IN statement I set up a PATINDEX('%:'+countyname+ ':%', ?) > 0 call to check for the values in my database call. As you can see I took out the "," that I was passing as part of my string, thinking that the SQL component was getting confused by them, and placed ":" characters around my values being passed in my string variable. No matter what I try to do though I'm not able to get the query to run. The component looks like it is taking my string, and is seeing the whole thing as a string instead of passing it as individual values within a string.
    I think I'm getting close, but I keep getting a Content not allowed in prolog exception in the server logs.

  • How to pass a parameter into a sql expression?

    How to pass a report parameter into a sql expression?

    Hi Donald,
        The functionality of using a parameter in a function is only available in the formula editor and not in SQL Expression. Parameters cannot be passed to the SQL Expression, the main purpose of the SQL Expression is to make use of Database functions to make calculations at the database level but the current functionality of the product only allows you to use Database fields.
    There is an article that talks on SQL Expressions and can be useful http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016184&sliceId=&dialogID=6018612&stateId=1%200%206020316
    Regards,
    Vinay

  • Passing user parameter into your sql query

    I've created two user parameters...'Order_date_from' and 'Order_date_to'
    I've written a simple query to list the total order amount, order number, party name and ordered date
    Select sum ((unit_selling_price)*(ordered_quantity)), count(line_number), oe_order_headers_all.order_number, hz_parties.party_name, oe_order_headers_all.ordered_date
    from oe_order_lines_all,
    oe_order_headers_all,
    hz_parties,
    hz_cust_accounts
    where oe_order_lines_all.header_id=oe_order_headers_all.header_id
    and oe_order_headers_all.sold_to_org_id = hz_cust_accounts.cust_account_id
    and hz_cust_accounts.party_id = hz_parties.party_id
    group by order_number, party_name, ordered_date;
    I want to know how I can pass the value for the above mentioned parameters into my sql query so that it reflects as the 'ordered_date' in the report and only shows the data for the dates that the user inputs.
    Any feedback would be appreciated. Thanks.

    I want to know how I can pass the value for the above
    mentioned parameters into my sql query so that it
    reflects as the 'ordered_date' in the report and only
    shows the data for the dates that the user inputs.
    Any feedback would be appreciated. Thanks.And how does the "user" input these dates?

  • Best practice to pass a value into a sub-process

    Hi
    I'm new to Oracle workflow and have the following problem/question.
    I have three identical subprocesses (one for each category) which should run in parallel, and I need to know for which category I'm running inside the activities of these subprocesses.
    Of course I would like to define the subprocess only once an reuse it for the other two parallel paths.
    What's the best way of doing this and how should I pass the category into the subprocess.
    I can think of the following
    - use an item attribute to pass the CATEGORY
    - use a process attribute to pass the CATEGORY into the subprocess
    - use the <process_name> of WF_ENGINE.GET_ACTIVITY_LABEL (each subprocess having a different process_name)
    Is there a better way of doing this ?
    Thanks
    Guido

    Unfortunately there is a limitation that Oracle Workflow does not support using a subprocess activity multiple times within a process hierarchy.
    See http://download-west.oracle.com/docs/cd/B10501_01/workflow.920/a95265/defcom36.htm#pact
    You could create one subprocess and then make copies with different names, and include logic in the main process to transition to the appropriate one.

  • How to pass 1D array into matlab?

    1 had 2 1-D array
    array1 = 1D array signed 32-bit integer numeric
    array2 = 1D array double-precision floating-point numeric
    how do i pass this 2 arrays to matlab script??
    help....as i'm very new to both labview and matlab.
    thks,lyn

    LabVIEW has a Matlab Script Node (Programs >> Mathematics >> Formula) that you can use to interface between the two programs. To pass arrays into the script node do the following:
    1. Right-click on the left edge and select "Add Input"
    2. Give the input a variable name in the termainal that was created.
    3. Right click on the terminal and select Choose Data Type >> Real Vector.
    You can now wire the 1D array to this terminal. You enter your Matlab Commands as text inside the node and you can create outputs the same way to created inputs.

  • Passing JSP value into an SQL Query

    Hi,
    I am developing a site for a cruise ship company as part of a project. My problem is as follows . . .
    I have a page called cruiseReservation.jsp which passes the value of the selected cabin to the cruiseDetails.jsp page:
    href="CruiseDetails.jsp?cabin_id=cabinE105 " so . .
    cabinE105 was selected.
    my database table for the cabin is as follows:
    create table cabin (
    cruise_id number primary key,
    cabinE105 number,
    cabinD113 number,
    cabinC131 number,
    cabinB127 number,
    cabinA101 number,
    FOREIGN KEY(cruise_id)
    REFERENCES cruisedetails(cruise_id)
    In the cruise details page im running the following code to update the cabin tables cabinE105 value to 0:
    String cabin = request.getParameter("cabin_id");
    String setCabin = "update cabin set '"+cabin+'" = 0 where cruise_id = 1";
    What im trying to do is pass the value of the cabin into the update statement so it updates cabinE105 = 0 where cruise_id = 1.
    How do I dfo this as the above method is not working ??
    I would like any help on this PLEASE !!! THANKS !

    String cabinID = request.getParameter("cabin_id");
    PreparedStatement ps=connection.prepareStatement("update cabin set "+cabinID+"=? where cruise_id=?");
    ps.setInt(1,0);
    ps.setInt(2,0);
    ps.executeUpdate();
    .Regards
    -John-

  • How to pass a parameter into execute sql task and later use it into dataflow task?

    i am in a situation, where i have a logging table in which i have a primary key called ETL_log_ID which is an identity column and acts as a foreign key for various fact table and dimension tables which are populated using SSIS packages. Now i wanna use the
    ETL_log_ID as a parameter in the execute sql task which populates the log table and pass the same value in the data flow task which populates the facts and dimension. Can you let me know how to pass the parameter in a step by step procedure.
    Thanks,
    Nikhil
      

    Nikhil,
    You can check the following :
    http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx
    http://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis
    Regarding the usage in Dataflow task, Can you elaborate on that a little?
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Passing a list into a sql procedure via a unix shell.

    9.2.0.6
    for some dumb reason we cannot use java to do this task.
    anyways
    I need to build a list of all file in a particular directory. The list could be zero to very very long. I would like to be able to pass that list to a PL/SQL procedure.
    this is in unix
    I think I could do something like
    var=f1,f2,f3,f4
    sqlplus blah/blah $var
    exec my_proc(&var);
    I guess that would handle up to 32k in length. It would be up to me to parse the list.
    I am really looking for an way to do this a bit slicker.. like with a ref cursor but I seem to be getting stuck.
    Thanks

    Some examples here :
    Re: How to pass Character parameter
    Nicolas.

  • How to pass a value into a SQL Query?

    Hi There,
    I want to know if there is a possibility to pass a dynamic value in a sql query. For example I have a currency rate value (ex: rate = 1.319, 2.23 etc) which user wants to input when running the query (The rate is not taken from the system, so I cannot compare to any table column and pass it as a parameter).
    And this rate has to be used in my query to do some calculation. Is this possible? The value :p_currency_rate doesn't work
    Any ideas please?
    Thank you,
    Prathibha

    SELECT DISTINCT
    hou.name
    ,poh.segment1 po_num
    ,pol.line_num po_line_num
    ,poh.currency_code
    --,trunc(poh.creation_date) po_creation_date
    ,pol.cancel_flag
    ,msi.segment1 item_num
    ,pol.unit_price
    ,round(cost.item_cost,5)
    ,round((&p_rate * pol.unit_price),5) "CONVERSION"
    ,(cost.item_cost - round((&p_rate * pol.unit_price),5)) difference
    ,pov.vendor_name
    FROM
    po.po_headers_all poh
    ,po.po_lines_all pol
    ,po.po_vendors pov
    ,hr.hr_all_organization_units hou
    ,inv.mtl_system_items_b msi
    ,bom.cst_item_costs cost
    WHERE
    poh.po_header_id = pol.po_header_id
    and pov.vendor_id = poh.vendor_id
    and poh.org_id = hou.organization_id
    and hou.organization_id = :p_operating_unit
    and poh.currency_code = :p_currency
    and poh.creation_date between :po_creation_date_from and :po_creation_date_to
    and poh.type_lookup_code = 'BLANKET'
    and msi.inventory_item_id = pol.item_id
    and cost.INVENTORY_ITEM_ID = pol.ITEM_ID
    --and (cost.item_cost - pol.unit_price) <> 0
    and (cost.item_cost - round((&p_rate * pol.unit_price),5)) <> 0
    and cost.organization_id = 1
    and msi.organization_id = 1
    and cost.cost_type_id = 3 --- Pending cost type
    and nvl(upper (pol.closed_code),'OPEN') not in('CANCELLED', 'CLOSED', 'FINALLY CLOSED', 'REJECTED')
    and nvl(upper (poh.closed_code),'OPEN') not in('CANCELLED', 'CLOSED', 'FINALLY CLOSED', 'REJECTED')
    and nvl(pol.cancel_flag, 'N') = 'N'
    and &p_rate user parameter
    I want this p_rate to be passed as a user parameter.

  • Passing values and calling PL/SQL process via a column link

    Hello all
    I have a report and a link on one of the columns which takes you to another page and passes data from the report to that page. That all works fine. In addition to picking up the details from the report I'd also like the link to call a page process before it goes to the next page using some of the values picked up from the report. This I can get to work by changing the link to a URL and putting in some javascript ie javascript:doSubmit('TEST_PROCESS'); By doing this I "lose" the ability to pass the info from the report via the link.
    Can anyone give me a clue as to how I can achieve both please? I'm assuming I'll need to create my own javascript function but I don't know how to pick up information from a row in a report to pass on.
    Regards
    Helen

    Lets say your link would pass 2 items P1_ITEM and P1_ITEM2 to your process. Just write a quick javascript function to do this and put it in the header:
    <script type="text/javascript">
    function doSomething(pValue1,pValue2){
      $s('P1_ITEM',pValue1);
      $s('P1_ITEM2',pValue2);
      doSubmit('TEST_PROCESS');
    </script>This will set 2 hidden items equal to whatever you pass in. Then you can use these in your after-submit process. To call this from your url, just make the url:
    javascript:doSomething(#COL1#,#COL2#);#COL1# and 2 being your report columns. This should do what you need i think

  • Passing an array into an Event Handler?

    An inventory project I am working on is requiring me to create JButtons (First, Last, Next, and Previous) which are supposed to cycle through and display (in JTextFields) the contents of an array of objects. I can make the buttons work if I do this:
    numberfield.setText("This works when used in the event handler");
    but it does not work when I try to do this:
    numberfield.setText(dirtbikes[0].getNumber());
    When I try this, I get this error:
    InventoryGUITest2:java:124:cannot find symbol
    symbol : variable dirtbikes
    location : class InventoryGUITest2
    numberfield.setText(dirtbikes[0].getNumber());
    ^
    I'm not sure if what I am trying to do is possible, but any guidance would be greatly appreciated. I have included the code for the main class below. Thank you for your time.
    import javax.swing.*; // imports all javax.swing classes
    import java.awt.event.*; // imports event handling components
    import java.awt.*;
    public class InventoryGUITest2 extends JFrame implements ActionListener // class tests an instance of class Inventory using a GUI to display data
         JTextArea textArea;
         JLabel numberlabel, namelabel, speedlabel, pricelabel, stocklabel, restocklabel, valuelabel, totalvaluelabel; // creates JLabels
         JTextField numberfield, namefield, speedfield, pricefield, stockfield, restockfield, valuefield, totalvaluefield; // creates JTextFields
         JButton firstbutton, lastbutton, previousbutton, nextbutton; // creates JButtons for navigation
         public static void main( String args[] ) // begins Java execution
              Dirtbikes dirtbikes[]; // declares array variable
            dirtbikes = new Dirtbikes[4]; //declares array with length of 4
            // populate array
              dirtbikes[0] = new Dirtbikes( "11", "49cc Dirt Bike", 4, 199.99, "25 mph"  );
              dirtbikes[1] = new Dirtbikes( "12", "90cc MotoX Bike", 7, 1299.99, "45+ mph" );
              dirtbikes[2] = new Dirtbikes( "13", "70cc Pit Bike", 3, 359.99, "35+ mph" );
              dirtbikes[3] = new Dirtbikes( "14", "50cc Street Rocket", 5, 879.99, "55+ mph" );
            // end populate array
            new InventoryGUITest2(dirtbikes); // creates new instance of itself
         } // end main method
        // constructor creates and runs GUI
         public InventoryGUITest2(Dirtbikes[] dirtbikes)
            this.setSize(500,300);
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              this.setTitle("Dirt Bike Inventory");
              JPanel panel1 = new JPanel(); // creates panel to imbed buttons into bottom of frame
              firstbutton = new JButton("First");
              firstbutton.addActionListener(this);
              panel1.add(firstbutton);
            lastbutton = new JButton("Last");
            lastbutton.addActionListener(this);
            panel1.add(lastbutton);
            previousbutton = new JButton("Previous");
            previousbutton.addActionListener(this);
            panel1.add(previousbutton);
            nextbutton = new JButton("Next");
            nextbutton.addActionListener(this);
            panel1.add(nextbutton);
            this.add(panel1, BorderLayout.SOUTH);
            JPanel panel2 = new JPanel(); // creates panel to imbed labels and fields into frame
            panel2.setLayout(new FlowLayout(FlowLayout.RIGHT));
            numberlabel = new JLabel("Item Number:                                      ");
            numberfield = new JTextField(25);
            numberfield.setEditable(false);
            panel2.add(numberlabel);
            panel2.add(numberfield);
            namelabel = new JLabel("Item Name:                                          ");
            namefield = new JTextField(25);
            namefield.setEditable(false);
            panel2.add(namelabel);
            panel2.add(namefield);
            speedlabel = new JLabel("Top Speed:                                           ");
            speedfield = new JTextField(25);
            speedfield.setEditable(false);
            panel2.add(speedlabel);
            panel2.add(speedfield);
            pricelabel = new JLabel("Price:                                                     ");
            pricefield = new JTextField(25);
            pricefield.setEditable(false);
            panel2.add(pricelabel);
            panel2.add(pricefield);
            stocklabel = new JLabel("# in Stock:                                            ");
            stockfield = new JTextField(25);
            stockfield.setEditable(false);
            panel2.add(stocklabel);
            panel2.add(stockfield);
            restocklabel = new JLabel("Restock Fee (5%):                              ");
            restockfield = new JTextField(25);
            restockfield.setEditable(false);
            panel2.add(restocklabel);
            panel2.add(restockfield);
            valuelabel = new JLabel("Total Value with fee:                          ");
            valuefield = new JTextField(25);
            valuefield.setEditable(false);
            panel2.add(valuelabel);
            panel2.add(valuefield);
            totalvaluelabel = new JLabel("Total Value with fee (for all items):");
            totalvaluefield = new JTextField(25);
            totalvaluefield.setEditable(false);
            panel2.add(totalvaluelabel);
            panel2.add(totalvaluefield);
            this.add(panel2);
            this.setVisible(true); // makes frame visible
              this.setLocationRelativeTo(null); // centers window on screen
         } // end constructor
                   public void actionPerformed(ActionEvent e)
                        if (e.getSource() == firstbutton)
                             numberfield.setText(dirtbikes[0].getNumber());
                   }

    bwilde wrote:
    I appreciate the help as everything I thought I had learned about Java has seemed to fall by the wayside in the shadow of making Swing/AWT work properly.You're not the first person to write this, or code like this in the forum. But realize it isn't true. GUI coding isn't a special case -- it's just another example of object-oriented programming. What's really happening is that the training wheels have come off: Writing a simple Swing example is often the first time one is writing anything that is not trivial.

  • Passing the array into actionPerformed method

    Hi friends! I am new at java. I made a tictactoe game board with GUI and it is designed according to nxn (desired any n value). When I pressed to any button, it should write an X to my board but I could not passed the button's action. My problem is that my actionPerformed method does not accept array button[j]. In the below there is a part of my code :
    for(int j=0;j<button.length;j++)     // adding the buttons
    button[j].addActionListener(this);
    public void actionPerformed(ActonEvent evt)
    // what can I read here for detecting the right button? button length is changable, it is depent on what we desire at first.
    // I tried this code in this area but it does not work:
    // if (evt.getSource()==button[j])
    // button[j].setText("X");
    // normally, it works if I write every button individually like that:
    // button1.addActionListener(this); (same for other buttons)
    // public void actionPerformed (ActionPerformed evt)
    // if (evt.getSource()==button1)
    // button1.setText("X"); (same code for other buttons)
    // but I want to make a generalized board action
    }I will be appreciated with your helps...
    Musty

    Hi musty4284,
    The getSource method of ActionEvent(not ActonEvent) returns an object and the way you're comparing objects is wrong.
    Theorically, you should do something like this :
    public void actionPerformed(ActionEvent evt) {
        JButton b = (JButton) evt.getSource();
        if ( button[j].equals(b) ) {
    }Edit :
    When using a listener for an array of JButton, it is a good idea to give a unique identifier to each button (for example, their index in the array). The JButton class has a setName method not to confuse with the setText method.
    While building your array of JButton, you can do :
    JButton[] button = new JButton[9];
    for (int i = 0; i < 9; i++) {
        button[i] = new JButton();
        button.setName(i);
    While handling the event :public void actionPerformed(ActionEvent evt) {
    JButton b = (JButton) evt.getSource();
    int index = Integer.parseInt(b.getName());
    button[index].setText("X");
    Edited by: Chicon on Oct 4, 2009 11:20 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Passing array into resultset

    hi,
    is it possible to pass an array into a resultset? if yes please indicate how.
    thank you all in advance

    Hi,
    Sorry for the confusion, here's what I'm trying to accomplish.
    I'm trying to create a report in Crystal Report and use Java as data source. My Java application needs to generate some value and pass them to the report as parameters. After some research I've found that I can use a Java Bean class as data source for Crystal Report that returns a ResultSet. Therefore I'm trying to pass some values in my Java app into the Bean class as array and convert them to a ResultSet for Crystal Report.
    If you know of a different way please let me know, otherwise, this is what I meant by passing array into resultset.
    thanks for your reply,

  • How to pass vector array to JasperReport

    I have a query looks like this... in my JasperReport. (select * from employee where employee_id = $P{Emp_ID} order by employee_id)
    I already created a vector array contains a list of employee IDs from database. Now, I want to pass the array into the query to get a specific list of employees.
    Similar to SQL prompt below.
    SQL> select * from employee where employee_id in (1,3,4,5,22,23,45) order by employee_id.

    jasontey,
    I'm doing the samething here but with arrays and I'm getting ClassCastException.
    Servlet1:Vector PatientInfoVector = new MdlPatient().getPatientInfo(userId,patientNumber);
    int patientLength = PatientInfoVector.size();
    MdlPatient[] PatientInfoArray = new MdlPatient[patientLength];
    for (int i=0; i<patientLength; i++)
    PatientInfoArray[i] = (MdlPatient)PatientInfoVector.elementAt(i);
    session.setAttribute("patientSession",PatientInfoArray);
    response.sendRedirect(response.encodeRedirectURL("/FsuSecurity/SrvSecurity"));
    SrvSecurity:
    MdlPatient PatientInfo = (MdlPatient)session.getAttribute("patientSession"); This is where I'm getting the ClassCastException.
    int patientNumber = PatientInfo.getPatientNumber();
    Thanks if you can help,
    Doug

Maybe you are looking for

  • JDeveloper 10.1.3.2 deployment bug

    Hello, I am experimenting with JDeveloper 10.1.3.2. When I make any web application it runs fine in the embedded OC4J. When I try to deploy to standalone server however or to war or ear file it fails. I've noticed that the archive in fact contains on

  • LCM causes Essbase security to be overwritten and can no longer log in.

    When using LCM and migrating Foundation / Shared Services and loading it back in from the file. It somehow overwrote something with Essbase security so no user (including the admin) can log in. Through EAS or through Workspace / Planning Any suggesti

  • Video with my Nokia c3 problem

    i have nokia c3 device and when i download or receive a video with mpeg-4 format is says not supported file and some times it ask me to format the memory sd

  • Sequence values

    I have a sequence whose max value with the help of a trigger is inserted in a table column. I've noticed that sometimes the consecutive values of the sequence differ not by one but by variable number. I have Increment by 1 and Cache 20 in the sequenc

  • Custom code coloring

    dreamweaver 8 PHP Syntax coloring i am wanting to color all inside <<<EOD and EOD; to red so all code between appear as a string where do i make this change in the XML files available