IN operator with more than 1000 values

Hi,
For a given list of IDs (PKs), I need to fetch the corresponding rows.
The problem is that I have more than 1000 values and as far as I know that IN operator is limited to 1000
values.
I thought about using UNION such that each Select contains up to 1000 IDs.
example":
select * from temp where id in(1....1000)
union all
select * from temp where id in(1001....2000)
Is there a better way to do that?
Thanks
dyahav

As others have presented technical solutions, i'll present you a logical one (seemingly logical anyways, but it will depend on your application).
I have seen some applications where you get
select * from some_table where ... <conditions>;That result set is returned to the front end and presented to the users who then pick a series of records and submit another request to the database which ends up being...
--note, this could be a many table join, with lots more information that just the some_table, this is illustrative only
select * from some_table where pk_value in (super_super_duper_list_based_on_last_result_set);If this mimics what you have in your application, i'd recommend just fixing it so the users can select a reasonable set of data, OR the entire set (in the last case you'd just send the <conditions> instead of a massive list of PK values).
Again, highly speculative but i thought i'd mention it in the off chance it's useful to you.

Similar Messages

  • Call Transaction and fill a select-options field with more than one value?

    Hello everybody,
    how can I fill a select-options field with more than one value.
    Here is the code example:
      CLEAR: GT_BDCDATA, GS_BDCDATA.
      GS_BDCDATA-program = 'RHALEINI'.
      GS_BDCDATA-DYNPRO = '1000'.
      GS_BDCDATA-DYNBEGIN = 'X'.
      APPEND GS_BDCDATA TO GT_BDCDATA.
      CLEAR: GS_BDCDATA.
      GS_BDCDATA-FNAM = 'PCHOTYPE'.
      GS_BDCDATA-FVAL = 'P'.
      APPEND GS_BDCDATA TO GT_BDCDATA.
      CLEAR: GS_BDCDATA.
      LOOP AT gt_hrobjinfty INTO gs_hrobjinfty.
        GS_BDCDATA-FNAM = 'PCHOBJID-LOW'.
        GS_BDCDATA-FVAL = gs_hrobjinfty-objid.
        APPEND GS_BDCDATA TO GT_BDCDATA.
        CLEAR: GS_BDCDATA.
      ENDLOOP.
      CALL TRANSACTION 'PFAL' USING GT_BDCDATA MODE 'A'
                       MESSAGES INTO GT_MESSAGES.
    THX.

    Hi,
    Please refer the code below:
    *Code used to populate 'select-options' & execute report
    DATA: seltab type table of rsparams,
          seltab_wa like line of seltab.
      seltab_wa-selname = 'PNPPERNR'.
      seltab_wa-sign    = 'I'.
      seltab_wa-option  = 'EQ'.
    * load each personnel number accessed from the structure into
    * parameters to be used in the report
      loop at pnppernr.
        seltab_wa-low = pnppernr-low.
        append seltab_wa to seltab.
      endloop.
      SUBMIT zreport with selection-table seltab
                                    via selection-screen.
    Thanks,
    Sriram Ponna.

  • Essbase Variable with more than a value for use after in Planning forms.

    I want to now if it would be possible to create a variable with more than a value for use after in Planning forms.
    The variable that I want to use is created in Essbase.
    Example:
    &Years = FY08,FY09,FY10

    Hi.
    The only workaround I know for the problem is to create parent in the dimension.
    In your case, create member “planyears”.
    Then you define children that are shard (this are the multiple member for the variables FY08, FY09 etc..)
    Create Essbase sub variable that will have 1 member value “planyears”
    When you use the Sub Variable in form select function “Children” and in that case it will use the member FY08,FY09 etc on the form.
    Limitation: I’m working on version 9.2.0.3 so you can’t create hierarchy in the year dimension, but you can use it in other dimension.
    AE

  • Fill BEx Variable with more than one value via Custom Exit

    Dear SDN comunity,
    I want to fill a BEx Variable via a custom exit. My problem is, I don't know how to fill this variable with more than one value.
    I try to give you some background info based on an exaple:
    <u><b>Variable-Details</b></u>
    <b>Type of Variable:</b> Characteristic Value
    <b>Variable Name:</b> ZCCD
    <b>Description:</b> Company Code Selection
    <b>Processing by:</b> Custom Exit
    <b>Characteristic:</b> Company Code
    <b>Variable Represents:</b> Multiple Single Values
    <u><b>This is the used ABAP code:</b></u>
    WHEN 'ZCCD'.
    CLEAR l_s_range.
    l_s_range-low = '2002;2004'.
    l_s_range-sign = 'I'.
    l_s_range-sign = 'EQ'.
    APPEND l_s_range TO e_t_range.
    <u><b>The system returns this message:</b></u>
    Value "2002;2004" is too long for variable ZCCD
    appreciate your help!
    //michael

    Eugene, Marcus
    it works now, thx a lot!
    Please find attached the final code:
    CLEAR l_s_range.
    l_s_range-low = '2002'.
    l_s_range-sign = 'I'.
    l_s_range-<b>opt</b> = 'EQ'.
    APPEND l_s_range TO e_t_range.
    CLEAR l_s_range.
    l_s_range-low = '2004'.
    l_s_range-sign = 'I'.
    l_s_range-<b>opt</b> = 'EQ'.
    APPEND l_s_range TO e_t_range.
    (Delta to Marcus's code is bold)

  • More than 1000 values

    Dear All,
    I am using oracle 10g with odp.net. I have values more than 1000 to be passed in the IN condition. How do i achieve this. When i pass the values it says only 1000 parameters are allowed in the IN condition.
    Please let me know.
    Regards
    Fkhan

    fkhan wrote:
    What i have thought of is to insert all the selected values in a global temporary table and then in my procedure use the subquery and use the values from the global temporary table.A better approach than using a massive IN list of values. But still problematic ito having a user interface deal with a 1000+ item/code selection. Still a performance problem shipping that amount of data across the network every single time from every single client running this app. And still a flawed ito data modelling and 3NF.
    The correct approach would be permanent tables to deal with this. In its basic and simplest form:
    // defines a keyword for a 1000+ items/codes
    KEYWORDS = ( keyword_id, keyword_description )
    // associates a keyword id with an item/code id
    KEYWORD_MAP = ( keyword_id, code_id )The user interface displays the keyword description. The select clause uses the keyword_id to select from the KEYWORD_MAP the associated list of values as filter criteria for the main query (using a join or IN sub-select for example).
    If the keyword is more complex than this basic approach (e.g. partially dynamic and specific per user), then this basic approach can be extended to serve as a "+favourites per user+" list (kind of like bookmarks, but per individual user). Or designed as to cater for the business requirements.
    But as you have (very simplistic I realise) describe the problem so far, I do not see a problem as much as a basic flaw in your code and data model.
    A user interface for entering and selecting 1000+ codes is clunky. And slow. Sending that data across to Oracle is slow. Inserting that each time around into a temp table for use, is slow.
    There's a lot of moving parts here. And that always contributes in degrading performance and making stuff complex (and usually unnecessarily so).

  • Vector or ArrayList  use for dropdown with more than 1000 entries

    Hi Friends
    I am having more than 1000 entries of different TimeZone's which i need to display in a dropdown list.
    i am not able to decide whether i need to use a Vector or Arraylist for storing these values.
    please let me know which one will be best suited to use in case the list entry is more than 1000 characters.
    waiting for a positive reply from your side.
    Thanks & Regards
    Vikeng

    A JComboBox can be constructed from a Vector (rather than any other sort of List) without having to implement your own ComboBoxModel. (JList is similar).
    I agree with kajbj - a control like this with a thousand entries is rather poor interface design. One exception might be if the entries are sorted in some way, and you "jump" to the appropriate place in the list as the user types.

  • To display text field with more than 1000 length in ALV

    Hi Friends,
           I need to display material long text field which is more than 1000 length in ALV or Object oriented ALV.
    Please help me to resolve the issue.
    Regards,
    Jaya.

    Hi,
    U mean to say in a single cell of ALV ??
    It is not possible in ALV .. As per OSS note 857823
    Below is the reason for same.. I think you should to split in number of columns.
    Summary
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128 characters in the SAP GUI.
    Other terms
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen)
    Grid (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Reason and Prerequisites
    The data table that is sent to the front end only allows character values with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • List with more than 1000 elements

    I'm trying to use this query:
    select *
    from street
    where street_cod in ('street_code_list')
    It working well when the 'street_code_list' has less than 1000 codes but it fails when it have more, with a message that says that a list can't have more than 1000 elements. How can I fix this problem? Can I use any other kind of object to store my list?
    I'm querying the database in ColdFusion using ODBC.
    Thank you in advance,
    Rui

    Another thing to consider doing is simply creating a "list table" which would contain your list elements and allow you to do a
    SELECT X
    FROM Y
    WHERE X IN (SELECT X
    FROM Z)
    type query.
    I don't know where you are getting your list from, but if it is persistant (i.e, doesn't change with every program run) this is certainly a viable option (and may be usable even if the list does change every run).
    If this is being executed in PL/SQL (or some other procedural language) you could also just loop through your list: execute the query with the first 1000 list elements and do your processing, then the next, and so on. Of course, to some extent this depends on your processing, but if you need the entire result set before you can process it, then you could store the individual result sets in a PL/SQL table or an array (if you are using Pro*C or whatever) and then process when the PL/SQL table/array was fully populated.

  • Problems with query with more than 20 values in the select clause

    I have a region based on a function returning a SQL query. It needs to have more than 20 values in the select clause. When I run the page I get a no data found error in the region. I managed to reproduce this behavior with just the following as the select returned by the function:
    select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21
    from dual
    I am running the 1.3.9.00.15 release of Marvel on 9.2.0.2 of the db on Solaris.

    Hello Raju,
    I will email you the connection settings when I return to the office.
    One thing I should have mentioned: The sql string is returned from a package in the db, so the query region text I originally posted isn't quite correct.
    it is something like:
    declare
    begin
    return my_pkg.my_fnc;
    end;
    the stored package is nothing more than:
    package my_pks is
    funtion my_fnc(i_test_param in varchar2) is
    begin
    return 'select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21 from dual';
    end;
    end;
    Sorry for the inaccurate info in the first post, but I am away from the server in question right now.

  • Error occurs when executing an item in an inbox with more than 1000 entries

    Hi Everyone,
    One of our approvers in SRM experienced an error when his inbox contained more than 1000 entries .  Further execution on any inbox item produces errors.
    Would you know where to set the maximum allowable entries in a user's inbox? Can this be set thru SRM config or Basis functionality?
    We also searched for existing SAP Notes but found nothing.
    Your inputs and help are greatly appreciated.
    Thanks and Regards,
    Vhong

    Hello,
    The user has sent me the screen shot. But this has no error messages. The approval transaction shows an ITS screen/code with template 'bbpapproval/99/saplbw02_1200.html'
    However, we have a user in Quality where the page displays with no problem and with 1675 Entries.
    Do you think this is more of an ITS setting or any Template/JavaScript issues?
    I got this code (view source code) earlier today and the topmost header of the code is:
    <!--
    This page was created by the
    SAP Internet Transaction Server (ITS, Version 6200.1025.7214.5, Build 908978, Virtual Server Q36, Add. service info none, WGate-AGate Host esetnmw028, WGate-Instance Q36)
    All rights reserved.
    Creation time:  Mon Mar 15 07:21:39 2010
    Charset:        iso-8859-1
    Template:       bbpapproval/99/saplbw02_1200.html
    -->
    Regarding the not-so-good practice of approvers to have more than 1000 entries in their inbox, we are still in the process of planning on how to divide the task to different approvers since there is only one approver (Project Manager) for the related network.
    Thanks and Redards,
    Vhong

  • Oci error in report 6i in reports with more than 1000 pages

    hi
    in a report that has more than 1000 page output , run in report 6i while formatting pages an error occurs:
    OCI error.==>SELECT NAME,
    what this means?
    please help me.
    CAROL.

    in reports that i know number of pages for example 1100 pageswhile formatting pages 150-200 this error occurs.
    Did you get the error if total report pages < 1100?
    indeed in another report with about 3500 pages output this error not occurs. Any diff. of setting/limits etc. between your two reports?

  • Error Creating Invoices with more than 1000 positions

    Hello.
    I am creating invoices in SD module with VF01 transaction.  When the document has more than 1000 positions an error is displayed.
    The text of the error is:
    Memory area p.status GUI SAPMV60A SM is too small.
    área memoria p.status GUI SAPMV60A SM demasiado pequeña.
    I would like to know if there is any way to correct this error. If it happens because memory is too small, how could it be increased?
    Thank you.
    Diana Carolina.

    Hi Diana
    As far as I know, standard SAP has restricted the no. of line items in an accounting document to 999.
    So, this is in turn impacts the no. of line items you can have on a Sales invoice,
    Since every invoice  line item can have atleast 2 accounting entries, the max. no. of  invoice line items you can have is 499.
    I dont think there is no work around for this
    Rgds

  • Table with more than 1000 columns

    I need to store data from an equipment that logs 1500 parameters every minute. The natural approach would be to create a table where the first column stores the timestamp and the remaining columns the values sampled:
    CREATE TABLE parameters (
    sample_date date,
    param1 float,
    param2 float,
    param1500 float
    However, since there is a limitation of "just" 1000 coluns in Oracle, the table was designed as follows:
    CREATE TABLE parameters (
    sample_date date,
    param_id number(4),
    value float
    An auxiliar table stores the valid parameters and their ids.
    This works fine to store information, however it is very difficult to select data in a natural way.
    There are situations where we just need to make a report using a few columns out of the 1500 available. Is it possible to create a view that would make the way we designed the table transparent? Let's say we just need to make a report using params 1,2 and 4. How can we create a view that would return all parameters of a sample in a single row:
    sample_date param1 param2 param4
    just as if we had the parameters stored in individual columns?
    Marco

    Not a very efficient and space friendly design to do name-value pairs like that.
    Other methods to consider is splitting those 1500 parameters up into groupings of similar parameters, and then have a table per group.
    Another option would be to use "vertical table partitioning" (as oppose to the more standard horizontal partitionining provided by the Oracle partition option) - this can be achieved (kind of) in Oracle using clusters.
    Sooner or later this name-value design is going to bite you hard. It has 1500 rows where there should be only 1 row. It is not scalable.. and as you're discovering, it is unnatural to use. I would rather change that table and design sooner than later.

  • RS 232 with more than 1000 Hz

    I am trying to read out data from a serial port which is given out constantly by a measurement device at a predefined rate (up to 4000 Hz). It is connected via USB which creates a virtual Com-port with a baudrate of 921600. Communication works with the device. In order to transfer these high rates the data stream of the device is set to binary ("$BIN" command). I use the VISA-read to get the data. The problem is that there occur bad (zero) values if I increase the data rate to 1000 Hz or higher. Is Labview not able to handle it? Or is it a buffer problem? Please check the attached VI. Is it possible to transfer the data stream at the given frequency to Labview?
    Thank you,
    Karsten 
    Attachments:
    CHR2.vi ‏127 KB

    Thanks for the mods and comments.
    The instrument can be connected by RS232 or USB. The USB connection creates a virtual Com port, so I thought it was equivalent?
    I placed the "close visa" inside the loop because I get a buffer overrun else. But it's logical that this takes time :-/
    About the transmission format... As far as I see it I only need 4 bytes per transmitted set of data.
    I copy a part from the instrument handbook here:
    8.3 Data telegram format
    The CHRocodile E supports RS232 with extended Data rate (921600/sec)
    and USB Full speed (12MBit/sec) interface.
    The interface does not use hardware or software handshake. The computer
    must therefore be able to receive the incoming data flow at any time in order
    to correctly receive the acquired data. The possible Baud rate ranges from
    9600/sec to 921600/sec, but the highest possible Baud rate should be
    preferred in order to be able to use the high measuring rate of up to 4 kHz
    which is provided by the CHRocodile E.
    The Baud rate is set via the keyboard ([F4] > [F3]…: serial port baud rate).
    During normal operation the CHRocodile E continuously sends data
    telegrams. The telegram rate is determined by the CCD-Scan rate divided by
    the selected average number.
    The telegram consists of up to 16 data words, each 16 bits wide. These
    words can be transmitted either as numbers represented in ASCII characters
    or binary as 2 bytes with the MSB transmitted first.
    ASCII mode
    data 0,data 1,....,data N CR/LF
    The enabled data words (selected by $SOD command) are output in ASCII
    representation, each 5 characters long, ranging from 00000 to 65535,
    separated by commas.
    The telegram is concluded with carriage return / linefeed.
    It should be noted that the ASCII mode does not enable the transmission of
    the results at the full measuring speed of 4 kHz due to the inefficiency of the
    coding. For high speed data transfer, the binary mode must be used.
    Binary mode
    Telegram format: (the values between the <> signs mean one transmitted
    byte. The prefix 0x indicates hexadecimal notation.)
    <SSByte1>,<SSByte2>,<data 0 MSB>,<data 0 LSB>,...,<data N MSB>,<data N LSB>
    Each telegram consists of the selected data words, high byte first, and
    begins with the synchronisation sequence SSByte1, SSByte2.
    This sequence is equal to 0xFF, 0xFF after power up, but it can be changed
    by $SSQ-command.
    It must be noted that it is not sufficient to wait simply for the occurrence of
    this synchronisation sequence since it can occur also in the binary data
    stream (like the stop and start bit in continuous serial transmission can be
    ambiguous). It is intended that this sequence is used only to synchronise the
    entire data flow, not a single telegram. Since the length of the telegram is
    known, a transmission once synchronised will stay synchronous and the
    synchronisation sequence is only used to prove the state of
    synchronisationThere are two ways to achieve synchronisation:
    • stop the data flow by sending a command. After completion of the
    command the sequence ”ready CR/LF” will be sent and the CHRocodile E
    starts with a new telegram.
    • when you don’t receive the synchronisation sequence at the expected
    place, wait for the synchronisation sequence. This will synchronise the
    data flow in a few cycles since the transmitted data words are usually
    changing.
    Be careful that the chosen combination of Baud rate, Sample rate, Average,
    Data format and selected output data permits full telegrams to be sent.
    You should calculate 10/Baud rate+1 μsec per byte sent.
    Example
    This permits for example
    1/1000Hz /(10/115200Bd+0.000 001sec) =11,39 ≈ 10 bytes = 2Bytes (synchronisation
    sequence) + 4*2 Bytes (Data)
    to be transmitted at 1 kHz Data rate in binary mode.
    For example one transmitted set of data is (decimal notation) "255 255 077 184".

  • How to pass a parameter with more than one value to a report? (urgent)

    Hi, all
    I try to pass a parameter from a search form to a report in
    which I would like to print out my search result. My problem is
    I can pass the parameter to report but only one value which my
    cursor points to. could anyone tell me how to pass a list of
    value to the report? my trigger in form like this:
    declare
    PL_ID PARAMLIST;
    sc_no books.c_no%type;
    begin
    PL_ID := GET_PARAMETER_LIST('parametername');
    IF NOT ID_NULL(PL_ID) THEN
    DESTROY_PARAMETER_LIST(PL_ID);
    END IF;
    PL_ID := CREATE_PARAMETER_LIST('parametername');
    IF ID_NULL(PL_ID) THEN
    MESSAGE('PL/SQL held against Button failed to execute');
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    ADD_PARAMETER(PL_ID, 'PARAMFORM', TEXT_PARAMETER,'NO');
    sc_no := :searchlist.c_no; --(c_no is the value I want to pass
    but not only one.)
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    RUN_PRODUCT(REPORTS, 'reportpathname.rep', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, PL_ID, NULL);
    end;
    Thank you in advance
    Diana

    Is it your values in parameter NO separated by coma? And is it
    parameter in where clause?
    Do you want something like :
    from table
    where s_no in (NO) ?
    If is answer "yes" you can create lexical parameter in report.
    You can write in report sowething like:
    select a.field1, a.field2,.....
    from table a
    &COND /* this is if is condition only one line after "from".
    if you have more lien after where then you will put this &COND
    in line where you want to have your multivalue.
    Then in your trigger in form you should write:
    sc_no := 'where a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    /* again this is if you have only one line with WHERE ili
    conditions */
    or you will write:
    sc_no := 'and a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    It will substitute line in which is your conditions with
    multivalue.

Maybe you are looking for