Pass list of values in an array to the IN statement of SELECT in Oracle 10g

Hi,
This is what I have done so far...
I have loaded the main array array_number_1 using BULK Collect. Within the loop I am filtering the data from this array and writing to another array array_number_2.
I want to use the values from array_number_2 in the SELECT statement.
Eg: SELECT sum(x_amount) charges
FROM x_table
WHERE id IN (array_number_2).
Could you provide a solution to this preferrably with an example.
thanks

I'm not entirely following you, Visakh, but I have a SQL Task setup in which I have an expression that makes a call to a db2 database such as the abbreviated set example below.  The list of IDs in the IN statement must come from another  SQL Server
database.   In the past I have  gotten the list of IDs, put them in a recordset and then put that in a for loop to iterate and make one call to db2 for each and every ID.   The single ID example can literally take days to run for 100,000 IDs.
 Therefore, I want to pull the entire set of results back at one time via a single (or at least fewer calls than there are IDs) DB2 call using 'in' instead.  Maybe I am overlooking something but I don't quite see how your example will get me where
I want to go.  
Set Example
SELECT 
   A,
   B
FROM 
    Table 1, 
    Table 2, 
WHERE 
    Joins   
    AND PRSNEUP.ID in  ( This is where I want a list of IDs )
Single ID Example
SELECT     A,  
 B
FROM   
  Table 1,      Table 2, 
WHERE     
Joins        AND PRSNEUP.ID =  ( VariableContainingASingleID

Similar Messages

  • Passing list of values as a parameter to repot through form

    hi,
    i am trying to passing parameters to report through form by
    using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able to
    pass list of values to report.For example if use select state_id
    from the list box,it has to give all details of that state
    report.how to do this?
    please help me.
    thanks in adv
    rao
    null

    rao (guest) wrote:
    : hi,
    : i am trying to passing parameters to report through form by
    : using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able
    to
    : pass list of values to report.For example if use select
    state_id
    : from the list box,it has to give all details of that state
    : report.how to do this?
    : please help me.
    : thanks in adv
    : rao
    there are at least two path to do that:
    1. for each detail item mak a parameter in reports and add it to
    paramlist
    2. pass only stade_id as parameter and in reports query other
    details
    hope this helps
    null

  • Pass list of values to DB adapter from BPEL process

    We want to pass a list of values (length of list and values to be passed will be dynamically determined by the input to this invocation)
    How do we pass the input as a list of values to a db adapter where the list of values will form a part of input query where clause.
    say eg
    select date from tablea where columna in (List1,list2,lsit3) etc
    Thanks

    This will help you
    http://soa-howto.blogspot.com/2009/05/how-to-use-sql-query-having-in-clause.html

  • SQL Query: How to pass list of values to the IN operator

    Hi,
    I'm trying to pass a list of values to the WHERE <a> IN <list>
    I dont want to use dynamic cursors (REF CURSOR). Is this possible using Oracle SQL?
    Please let me know.
    My program:
    DECLARE
    list_of_ids := '10, 20, 30';
    SELECT MAX(sal) INTO max_sal FROM employee WHERE emp_id IN (list_of_ids);
    END;
    Thanks in Advance,
    Niko

    You do not want to pass a comma separated list. You want to pass a collection. So
    CREATE TYPE num_tbl
    AS
    TABLE OF NUMBER;
    DECLARE
      l_list_of_ids num_tbl := num_tbl( 10, 20, 30 );
    BEGIN
      SELECT max(sal)
        INTO max_sal
        FROM employee
       WHERE emp_id IN (SELECT * FROM TABLE( l_list_of_ids ));
    END;
    /Justin

  • Passing list of values to a function

    As what type list of values multiple selections, e.g. resulting in (1,2,3), are represented in function parameters?
    for example i have lov that results in (1,2,3) and dataset query is select myfunction(:mylov) from dual.
    Variable of what type I must declare in function definition?

    when i hadthe same situation , i used cursor query to resolve .
    eg.
    select myfunction(cursor(select field1 from table1 where field1=:parameter1)) from dual
    In the PL sql function get all thee parameters from the cursor variable and pass into the looping statement for furthur processing

  • List of values not properly working in the selection screen.

    Dear Mates,
    In BEx query all the selection parameters are working and showing all the list of values. Created the same report in crystal from BEx query, for one particular selection it is not showing the list of values or drop down. Just showing "DISCRETE VALUES"
    Please throw some light on this.
    Good day,
    Regards
    Arun S

    Hi Arun,
    I think you have more than one dynamic parameter created in your report.  There is a limitation on dynamic parameter list of values.  You will have to edit the registery to get all values in dynamic parameters list.
    Find below is a knowledgebase article ;
    Symptom
    For performance reasons, in Crystal Reports XI Release 1 and Release 2 the maximum number of values that are returned for a list of values is set to 1000. If you have a cascading List of Values (for example Country > Region > City), the lowest level (in this case City) will only display a maximum of 1000 values. This means that the higher-level prompts may display far fewer values than you expect. The list of values provides the data for the dynamic parameter list.
    How can you modify the maximum number of values available in a dynamic parameter list?
    Resolution
    To increase the maximum number of values available in a dynamic parameter list, you must add a registry key.
    CAUTION
    The following resolution involves editing the registry. Using the Registry Editor incorrectly can cause serious problems that may require you to reinstall the Microsoft Windows operating system. Use the Registry Editor at your own risk. For information on how to edit the registry key, view the 'Changing Keys and Values' online Help topic in the Registry Editor (Regedit.exe).
    It is strongly recommended that you make a backup copy of the registry files (System.dat and User.dat on Win9x computers) before you edit the registry.
    Crystal Reports XI Release 1
    Create a registry key HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV.
    NOTE
    Alternatively, you can create the registry key HKEY_CURRENT_USER\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV and that key will override the settings of the HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV key.
    Add a string value "MaxRowsetRecords" and set the value to the maximum number of values that you desire for your report. For example, a value of 2000 will return up to 2000 values in the lowest level of a cascading parameter. NOTE: The value 0 (Unlimited) will not work with BusinessObjects Enterprise XI or Crystal Reports Server XI, you must specify another value.
    NOTE
    The higher the number of values is, the longer it will take the Enter Values dialog box to populate with values.
    After making changes to the registry, restart the affected service or application as required.
    Crystal Reports XI Release 2
    Create a registry key HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV.
    NOTE
    Alternatively, you can create the registry key HKEY_CURRENT_USER\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV and that key will override the settings of the HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.5\Crystal Reports\DatabaseOptions\LOV key.
    Add a string value "MaxRowsetRecords" and set the value to the maximum number of values that you desire for your report. For example, a value of 2000 will return up to 2000 values in the lowest level of a cascading parameter.
    NOTE
    The value 0 (Unlimited) will not work with BusinessObjects Enterprise XI or Crystal Reports Server XI, you must specify another value.
    After making changes to the registry, restart the affected service or application as required.
    Thanks,
    Sastry

  • How to pass list of values to REF CURSOR?

    Hi there,
    I have a package for ref cursor return as following:
    <pre>
    create or replace package p_mypkg as
    type t_ref_cur is REF CURSOR;
    function f_t_refcur (strsql varchar2) return t_ref_cur;
    end;
    create or replace package body p_mypkg as
    function f_t_refcur(strsql varchar2) return t_ref_cur as
         cur t_ref_cur;
    sql_stmt varchar2(1000);
         begin
    sql_stmt:='select object_name,object_type from user_objects where object_type in (:j)';
              open cur for sql_stmt using strsql;
              return cur;
         end;
    end;
    var results refcursor
    begin
    :results:=p_mypkg.f_t_refcur('TABLE');
    end;
    print results
    var results refcursor
    begin
    :results:=p_mypkg.f_t_refcur('INDEX');
    end;
    print results
    I got the result sets using just one value.
    But I got nothing when use two values as input.
    Any idea?
    var results refcursor
    begin
    :results:=p_mypkg.f_t_refcur('''TABLE'',''INDEX''');
    end;
    print results
    SQL>
    no rows selected
    Thanks,
    SZ

    You can also use ...from table(... :
    create or replace type numbertype
    as object
    (nr number(20,10) )
    create or replace type number_table
    as table of numbertype
    create or replace procedure tableselect
    ( p_numbers in number_table
    , p_ref_result out sys_refcursor)
    is
    begin
      open p_ref_result for
        select *
        from employees , (select /*+ cardinality(tab 10) */ tab.nr from table(p_numbers) tab) tbnrs
        where id = tbnrs.nr;
    end;
    /

  • Passing multiple integer values as parameter in SSRS

    Hello,
    I am trying to pass a comma separated multiple integer value parameter in SSRS report and it errors out complaining that it is not able to convert the nvarchar value to datatype int. But it works fine when I pass a single value. Here is the code I am using
    for the report and I am stuck at passing multiple values.
    SELECT
    id,count(*) as cnt
    from table
    and ID in (@id) group by id
    eg: if I pass 10,20,30 then I would get error however if I pass 10 then it works fine
    Is there a different method to pass multiple integer values?
    Thanks for your help.

    A comma is, of course, a textual character and not an integer, thus the error you are getting. Multi-value parameters can be used for this.
    Select "Allow multiple values"and set data type to Integer. Multi-value parameters deliver the values as an array. The query interface is smart enough to convert them to the proper syntax (comma-delimited) automatically so a statement like:
    WHERE Field IN (@id)
    where the parameter has an array of values {1, 2, and 3} is interpreted as:
    WHERE Field IN (1,2,3)
    You do not need to manually convert it in a transact SQL query. That is not the case for displaying the value array in your report. If you wish to display the array (described above) in your report as "1, 2, 3", you will need to use a join expression:
    =Join(@id, ", ")
    As DJ described, the other part to a multivalue parameter is the Available values. These can be set explicitly but given your example, I think it would be best to create a new dataset that retrieves a distinct list of the IDs that can be retrieved, perhaps
    something like:
    SELECT DISTINCT GroupName, GroupID
    FROM table
    WHERE [criteria]
    Set the available values to use this query with GroupName (or whatever user-friendly field you choose for your dataset) as the label and the id as the value. The label field should be something the the target report user can easily identify the correct group
    using.
    If you don't want to or can't use a multivalue parameter for some reason then you will need to manipulate your parameter value prior to consuming it in your query. When you add the parameter to the TSql query and save the dataset, SSRS adds it to the Parameters
    property of the dataset. Open the dataset properties and select the parameters tab. You should see your parameter in the list. click the expression builder (fx) button next to the value and enter this expression:
    =Split(@id,",")
    Note that the second element of the expression is the delimiter. If your text input has comma-space as a delimiter (1, 2, 3 vs 1,2,3) then that element must include ", ". My example just has comma so if you use that with a string "1, 2, 3"then
    the resulting array will still have 3 elements but the 2nd and 3rd elements of the array will have a preceding space which will cause your dataset to error with the same error. As long as there are no non-numeric characters in any of the elements, the split6
    will create the text array, SSRS will dynamically generate the correct "IN"syntax (comma separated) and SQL will convert the elements from VARCHAR to INT on the fly.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How can we allow over 103,718 list of values to display in webi report selection?

    I know, why would we want to?
    Our business users would like to see the list ordered and first select from a range and drill down.
    Any query in information design tool already does this as well as the preview values for the LOV object.
    Is there a way to make large LOV function this way in webi query/report?
    If not, is there a way to move beyond the warning of 'Partial list'?

    These are all dependent parameters for LOV
    At BO Server level
    Web Intelligence Processing Server-> Maximum List Of Values Size (entries) - 50000 (default)
    Web Intelligence Processing Server-> List of Values Batch Size (entries) -1000 (default)
    At Universe level
    Array Fetch parameter at database.PRM file.
    Limit size of result set to --  parameter
    Query Level
    Max rows retrieved ( Click Query Properties to display the "Query Properties" dialog box.)
    You can try below steps
    Follow these steps to change the maximum size for a list of values:
    Log in to Central Management Console.
    Click Servers.
    Right click Web Intelligence Processing Server and select Properties.
    Increase the value of Maximum List Of Values Size (entries).
    Save and restart the Web Intelligence Processing Server.  Note: Setting large number for Maximum List Of Values Size (entries) may affect the performance of Web Intelligence. It is recommended to set the appropriate number according to the system performance.

  • List of values to PL/SQL procedure

    I want to execute a query of the form
    UPDATE myTable
    SET myField = someValue
    WHERE myTablePK IN (1, 3, 5, 7, 9)
    Through HTML, I have a form field that is a comma-delimited list of values. I want to be able to pass this to a stored proc. What I'm not understanding is how to pass a list of values.
    In other words, the form should be:
    UPDATE myTable
    SET myField = someValue
    WHERE myTablePK IN (someList)
    What data type should "someList" be? How do I pass it? The number of values in the list is variable and cannot be determined at design-time.

    Here is an example how to pass a list of values as an input to a stored procedure using dynamiv SQL:
    TAPAS>create or replace procedure create_my_view( dept_list IN VARCHAR2)
    2 authid CURRENT_USER
    3 AS
    4 sql_stmt VARCHAR2(1000);
    5 begin
    6 sql_stmt := 'create or replace view my_view as select deptno from emp where deptno in ('&#0124; &#0124; dept_list&#0124; &#0124;')';
    7 execute immediate sql_stmt;
    8 exception
    9 when others then
    10 dbms_output.put_line(SQLERRM);
    11 end;
    12 /
    Procedure created.
    TAPAS>exec create_my_view('10,20');
    PL/SQL procedure successfully completed.
    TAPAS>select * from my_view;
    DEPTNO
    10
    10
    10
    10
    10
    20
    20
    20
    20
    20
    20
    20
    20
    20
    14 rows selected.

  • Extracting a distinct list of values using the Index formula

    In Xcelsius, I am trying to retrieve a distinct list of values from data imported using the Reporting Services button.
    In the spreadsheet I am using the following formula:
    =INDEX($A2:$A831,MATCH(0,COUNTIF($B$2:B2,$A2:$A831),0))
    The above formula works correctly in Xcelsius, but when I select the preview button the values change to #N/A.
    Please could you advise on why this does not work?
    Many thanks,
    Natalie

    Hi Natalie,
    First, you have to be aware of the fact that Xcelsius "simulates" an Excel function. When you are in design mode, the actual "Excel" (MS code) functions are executed. But when you are in preview mode (or export to a swf), all Excel functions are simulated (Xcelsius code).
    The fact that your function works in design mode but not in preview/export may point to a bug.
    But there are also certain assumptions (to address speed/efficiency) on the Xcelsius code which may cause the preview to fail. One such assumption is that on the VLOOKUP function, Xcelsius does not recalculate formulas in the index column of the VLOOKUP table array - if the index column contains formulas, the index column will always remain in the initial state (will not dynamically recalculate).
    Also, not all features on a supported Excel function works. For example, array formulas are not supported.
    Bobby

  • Input List of values

    I currently have a input text field.
    How do I convert to a "Input List of values".
    I do have the lookup VO that needs to be used in the list of values.
    I tried the "right click" -> convert -> that does not show the "Input List of values".
    Thanks

    create lov popup manually..have af:inputText (set autoSubmit to true) & af:commandImageLink (get magnifier image from adf image lib). within af:commandImageLink invoke popup.
    create af:popup
    d&d vo as table
    to search pass inputText binding and execute vo
    have a ok button and get the selected row value

  • Prompt List of Values in WebI - SAP BI Variable - SAP BI Query -BI Infoset

    Hi,
    We have a Multiprovider built on an Infoset. SAP BI Infoset is built using 2 DSOs.
    There is a SAP BI Query on top of this Multiprovider.
    Multiple-Single Values type Optional Variables are created for some of the Objects of this SAP BI Query.
    Universe is created on top of this SAP BI Query, using SAP Integration kit.
    WebI is created on top of this Universe.
    Prompts are created on some of the Universe Objects, for the WebI report.
    We are facing a typical problem.
    When a WebI prompt is created on one particular object, (which also has a Multiple Single Value type Optional Variable in SAP BI Query), its List of Values is showing up only first three values in WebI. The SAP BI Variable in BEX Analyzer shows up all the 8 values for the List of Values, for the same object.
    The Output WebI report has more values for the object than shown up in the List of Values & this is the problem.
    We tried to keep the settings in Info-object, DSO, Infoset, Multiprovider = Values in Master Data (for the List of Values).
    Similar objects and similar variables for the same query / webi show all the List of Values.
    Any guidance on aspects to be checked would be helpful.
    regards,
    Rajesh K Sarin

    Problem :
    If an SAP BI Infoset is used in data modelling, and a restricted key
    figure is created in the SAP BI Query; the resultant WebI Object Prompt
    for the Info-object, only shows up LOVs which have been used for the
    restricted Key Figure. Both the things are not related except for the
    fact that some of the values for the same object are used for the
    restricted key figure.
    Details :
    We have a Multiprovider built on an SAP BI Infoset.
    SAP BI Infoset is built using 2 DSOs.
    There is a SAP BI Query on top of this Multiprovider.
    There is a restricted key figure in the sap bi query. KeyFigure "Number
    of Records" is restricted for 3 of the relevant Info-object "Meter
    Reading Status" values.
    Universe is created on top of this SAP BI Query, using SAP Integration
    kit. WebI is created on top of this Universe.
    Prompt is created on the Universe Object for Meter Reading Status, in
    the WebI report.
    List of Values is showing up only the three values in WebI (which were
    used in the Restricted Key Figure calculation).
    SAP BI Variable in BEX Analyzer for the same Info-object Meter Reading
    Status shows up all the 8 values for the List of Values.
    The Output WebI report has more values for the object than shown up in
    the List of Values & this is the problem.
    We have kept the settings in Info-object, DSO, Infoset,
    Multiprovider, Query = Values in Master Data (for the List of Values).
    When we delete the "Restricted Key Figure" from the SAP BI Query, the
    refreshed Universe and Webi have a complete set of List of Values
    applicable.   
    Steps for Reconstruction    
    1. Create Infoset
    2. Create SAP BI Query on Infoset
    3. Create Restricted Key Figure for Number of Records and few of the
    values for a characteristic info-object "X".
    4. Create BO Universe on SAP BI Query
    5. Create Webi on BO Universe
    6. Create a Prompt on the characteristic info-object "X".
    7. Check List of Values for the characteristic info-object "X" in SAP
    BI Query and WebI.
    8. LOVs in WebI are equal to the values used for restriction in the
    restricted key figure.
    9. Delete the restricted key figure from SAP BI Query.
    10. Refresh Universe
    11. Webi prompt shows all the values for the prompt on "X".

  • Passing multiple character values from parameter form to PL/SQL

    Hi,
    I am passing multiple character values from parametr form into
    the report query and a PL/SQL procedure. It works fine with the
    query, when I use &variable. But, it doesn't compile in PL/SQL,
    so I just used the :variable, but not getting any records in the
    PL/SQL procedure. Any suggestions?
    sincerely,
    gj

    gj / Fedro,
    Only using the &referecne, you can pas a string / multiple character values and this would work for query only.
    The bind parameter in PL/SQL wouls support only single value
    Thanks
    The Oracle Reports Team

  • List of values is not displayed in web inteligence report

    I created a web inteligence report and put into my favourite folder. The report consist of a selectable list of values in a prompt but it does not appear in my favourites folder.
    The users with administrator rights that copied this report into their own favourites folder are able to see the list of values in the prompt.
    It seemed that the list of values does not display in the prompt when non administrator rights opened this report in their own favourites folder.
    Anyone can figure out how to set the access rights so that non administrator can see the list of values when the web inteligence report is opened in their own folder.
    I am using Business Objects XI 3.1 ..

    SOLVED
         CMC -> Connections
    -     Right click connection name, Click u201CTools > Check Relationshipu201D
    -     In u201CQuery Resultsu201D, Right click Connections, Click u201CUser Securityu201D
    -     Assign Security for u201CEveryoneu201D
    -     UNTICK both Inherit from Parent Folder and Inherit from Parent Group
    -     Assign u201CView on Demandu201D
         CMC -> Universes
    -     Right click u201CUniversesu201D folder, click u201CPropertiesu201D
    -     Under u201CUser Securityu201D, click Everyone and assign security
    -     UNTICK both Inherit from Parent Folder and Inherit from Parent Group
    -     Assign u201CView on Demandu201D

Maybe you are looking for