Is a single Query possible for this?

Hi everyone,
I have a requirement to get a list of 10 free (non-assigned) ids from a table. The ids range from say 1-32000. The table contains only the assigned ids. So the idea is - if say we have 15 records already in this table like 2,7,23,4,65,22,665... etc (random, non-repeated, unsorted values), then I need to get the first 10 numbers in the range 1-32000 which are not there in the table e.g. 1,3,4,5,6,8,...etc. One idea is to have a table2 with a single column having values 1-32000 i.e. 32000 rows. Then we can give the query like -
select col1 from table2 where rownum<=10 and col1 not in (select id from table1);
Is there a better way to get this output without having a separate table with 32000 rows? Or, is it possible to form a faster query even with the proposed solution?
Thanks,
Regards
Sanchayan
null

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by [email protected]:
Hi everyone,
I have a requirement to get a list of 10 free (non-assigned) ids from a table. The ids range from say 1-32000. The table contains only the assigned ids. So the idea is - if say we have 15 records already in this table like 2,7,23,4,65,22,665... etc (random, non-repeated, unsorted values), then I need to get the first 10 numbers in the range 1-32000 which are not there in the table e.g. 1,3,4,5,6,8,...etc. One idea is to have a table2 with a single column having values 1-32000 i.e. 32000 rows. Then we can give the query like -
select col1 from table2 where rownum<=10 and col1 not in (select id from table1);
Is there a better way to get this output without having a separate table with 32000 rows? Or, is it possible to form a faster query even with the proposed solution?
Thanks,
Regards
Sanchayan<HR></BLOCKQUOTE>
Sanchayan,
Your problem can be solved by a single query.
Try the following query:
(THIS WILL GIVE AN IDEA")
select * from (
select rownum from (select numero from srm_test)
minus
select numero from srm_test)
where rownum < 10
order by 1
YOU WILL GET:
ROWNUM
1
3
6
8
10
11
12
7 rows selected.
The contents of srm_test are:
2, 7, 23, 4, 65, 22, 665, 90, 87, 200, 9, 5
null

Similar Messages

  • Pricing at time of goods receipt not possible for this item

    We're receiving error Message no. 06634 Pricing at time of goods receipt not possible for this item when trying to change the PO Pricing Date Category from No Control to 5 GR Date.
    The error message is clear and reads:
    Pricing at time of goods receipt not possible for this item
    Message no. 06634
    Diagnosis
    For this purchasing document item, you wish to specify that a new price determination process is to be carried out at the time of goods receipt.
    System Response
    Pricing cannot be carried out for the item at the time of goods receipt because the price was either entered manually or copied from the last purchasing document.
    The scenario is that we have a contract reference on a PO and the contract condition records are to be maintained as a new price is valid each day.  The problem without this is that the new pricing will not be reflected in the GR.
    What is the solution to overcome this issue?
    NOTE:  the Info Record conditions are not being read during GR as the PO references a contract.

    For further clarification the PO is referencing a contract and as such not pulling the pricing information from the info record and instead pulling the price from the conditions on the contract. 
    I want to change the pricing date category from " No Control" to "5 GR Date" however I'm receiving the error message stated and unsure of how to make this change.
    The intent is not to create a new PO each day the condition record is created and instead we are utilizing one PO referencing one contract with multiple date delimited condition records containing the daily pricing.

  • Adobe Offline Form - Parse method is not possible for this type

    Hi All,
    I have developed an application for the offline scenario of interactive adobe form. I tried to load the adobe form from my desktop. After pressing the button "Display form" it throws an error "Parse method is not possible for this type".
    If I include wdContext.getNodeInfo().getAttribute("pdfObject").getModifiableSimpleType() in the doInit() method of the view I receive this error -
    com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(UploadView.pdfObject): must not modify the datatype of a mapped attribute
    When I comment it out and upload I receive the error enclosed -
    Parse method is not possible for this type
    Can someone please help me with a step by step solution to this problem?
    Any help is highly appreciated.
    Many thanks,
    Divya

    Hi Divya,
    Please try to do it as stated below:
         IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("pdfObject");
         ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
         IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)type;
    Try putting the code in wdInit() or wdDoModifyView().
    Let me know if you still face the issue.
    Regards,
    Arafat

  • Parse method is not possible for this type

    I have a file upload component and one button in a view.
    I have created a binary type context element and mapped it with fileupload component.while clicking the submit button I am getting " Parse method is not possible for this type" exception.
    help me out.
    Thanks In advance

    Hi,
    Thanks for your response. I have written the following code in wddoinit():     
    IWDAttributeInfo attributeinfo = wdContext.getNodeInfo().getAttribute(IPrivateSubstanceDocView.IFileUpload02Element.DATA);
        attributeinfo.getModifiableSimpleType();
    fileUpload02 is my context.
    but I am getting a null pointer exception over here.
    can ypu please help it.
    Actually the case is this is a window, which is opening on click of a hyperlink on another View.
    With the action method I am calling this View.
    Thus on click of a hyperlink just I am opening a new  View then here I am a browse button etc...
    PLease help if you can

  • Parse method is not possible for this type Exception in web dynpro

    I have a file upload component and one button in a view.
    I have created a binary type context element and mapped it with fileupload component.while clicking the submit button I am getting " Parse method is not possible for this type" exception.
    help me out.

    Hi sridhar,
    Use this code for Upload
    context u create one attribute(up),u assign the data type as "Resource"(which is dictionary type)
    InputStream text = null;
        int temp = 0;
        try
             File file = new File(wdContext.currentContextElement().getUp().getResourceName());
             FileOutputStream op = new FileOutputStream(file);
             if(wdContext.currentContextElement().getUp()!=null)
                  text = wdContext.currentContextElement().getUp().read(false);
                   while((temp=text.read())!=-1)
                                                                       op.write(temp);
             op.flush();
             op.close();
        catch(Exception e)
         e.printStackTrace();   

  • Error :The function upload is not possible for this documentu2019

    Hi,
    The users are using Solution manager Help Desk system.
    When a specific user tries to create a message from the satellite system, and tries to upload a  document, he is unable to do so.
    He is getting an error message : 'The function <upload> is not possible for this documentu2019
    The message number is BCOS024.
    The user is unable to attach word, note pads, excel etc. any types of documents.
    He is able to type a description/ title etc and save the message. And the message is reflected in the Solution manager help desk system.
    He comes across that message only if he tries to upload an attachment.
    Please advice.
    Thanks in advance.

    Hi Kase,
    What version of SAPGUI you use?
    We had the same problem.
    This problem was solved once we upgraded SAPGUI to 710 Patch Level 11.
    Regards,
    Sanjai

  • No stock postings possible for this material

    Sir,
    while i try to post MB1A, i got this error "no stock postings possible for this material". kindly solve this issue asap.
    Regards
    Prince
    Edited by: Csaba Szommer on Dec 22, 2011 2:20 PM

    ok
    check these now---
    the  material which is giving error have to me managed as inventory managed material?
    in material master have you filled anything in the plant stauts field.
    check now in  EBD1 cross plant material fields
    may be u have blocked the material for the inventory activity via material master
    CHECK IT
    regards
    rohit

  • Sales order creation is not possible for this notification type

    Hello,
    I want to create Sales Order through following menu:
    Notification -- Functions - Sales order - CreateSelection of Order Type.
    But I get following message:
    'Sales order creation is not possible for this notification type'
    The message says: No sales order type is assigned to the notification type.
    But I did not find any such configuration where I can assign notification type to Sales Order document type.
    Please help.
    regards

    Transaction OIM9
    Menu Path
    Customizing > Plant Maintenance and Customer Service > Maintenance and Service Processing > Maintenance and Service Notifications > Notification Creation > Notification Types > Define Order Types and Special Notification Parameters
    Nomally CS (customer service) area use this function.
    Regards
    Luke

  • Capacity planning is not possible for this info structure

    Hi Gurus,
    When I create Rough cut planning profile, I am getting error message ""Capacity planning is not possible for this info structure""
    I am using info structure S994 copied copied from standard info structure.
    Please suggest to oversome this error.
    thanks  and regards
    Murugesan

    Hi,
    Make sure the capacity planning relevant field is maintained for the Infostructure config setttings in MC7F.
    regards
    Ratan
    Edited by: Ratan on Aug 10, 2009 7:49 PM

  • HT4623 I have an IPad Model MC497LL with version 4.2.1 (8C148) where do I find system updates to get this device to the highest version possible for this model?

    I have an IPad Model MC497LL with version 4.2.1 (8C148) where do I find system updates to get this device to the highest version possible for this model?

    Go back to the article you asked this question from, ignore the instructions for updating it wirelessly, scroll down, and follow those for updating it from iTunes on a computer.
    (93330)

  • How to Trace the single Query Hits for single User

    Hi BW Experts,
    I have one doubt.
    How do we know that How many times one User executed only one Report from last 2 months??
    How do we trace it in BW System
    Please tell me.
    Thanks in advance
    Regards
    Anjali

    Hi Anil,
    Thanks for the reply.
    I checked in RSDDSTAT Table. But I could not understand from that Table.
    How many times 'X' User is executed 'Y' Report (This is single Query/Report only) from last 2 months?
    Regards,
    Anjali

  • Breaking a single query using for loop to improve performance

    Hi,
    This is a continuation of my previous post which I marked Answered and few things are were left from my side and I was advised to post a new thread...
    [Will it be a good ply|http://forums.oracle.com/forums/thread.jspa?threadID=880922&tstart=0]
    will it be applicable to any query because I took this to simplify the thing to explain my case
    which is actually........... pull the data from some tables using joins and insert into some other tables .....
    I used few procedures for diff conditions one of them use plain' insert into select' and others use bulk collect technique.
    I followed the simple strategy (for DML ) by Tom Kytes ..and Steven Feuerstein
    Use single statement whenever it is possible..
    if not use PL/SQL with bulk collect to avoid for loop.
    Please correct me if I am wrong.
    Thanks and Regards,
    Hesh.

    A simple test can prove the case
    SQL> set serveroutput on
    SQL>
    SQL> create table t
      2  as
      3  select * from all_objects where 1=2
      4  /
    Table created.
    SQL> declare
      2    ltime integer;
      3  begin
      4      ltime := dbms_utility.get_time;
      5      insert into t select * from all_objects;
      6      ltime := dbms_utility.get_time - ltime;
      7
      8      dbms_output.put_line(ltime);
      9  end;
    10  /
    187
    PL/SQL procedure successfully completed.
    SQL> rollback
      2  /
    Rollback complete.
    SQL> declare
      2      ltime integer;
      3      type tbl is table of t%rowtype index by pls_integer;
      4      l_tbl tbl;
      5      cursor c
      6      is
      7      select * from all_objects;
      8  begin
      9      ltime := dbms_utility.get_time;
    10      open c;
    11      loop
    12          fetch c bulk collect into l_tbl limit 500;
    13          exit when c%notfound;
    14
    15          forall i in 1..l_tbl.count
    16            insert into t values l_tbl(i);
    17      end loop;
    18
    19      ltime := dbms_utility.get_time - ltime;
    20
    21      dbms_output.put_line(ltime);
    22  end;
    23  /
    390
    PL/SQL procedure successfully completed.
    SQL> rollback
      2  /
    Rollback complete.

  • Is ALV possible for this report layout?

    Hi,
    I'd like to know if I can create this layout in ALV (layout as seen below):
    ......................|..........Column Header1............|.......Column Header2..........|  ...
    ......................|.Col Header3..|..Col Header4.....|..Col Header5.|.Col Header6.| ...
    Row header1...|.....data..........|......data............|.......data........|......data.......| ...
    Row header2...|.....data..........|......data............|.......data........|......data.......| ...
    Row header3...|.....data..........|......data............|.......data........|......data.......| ...
    If this is possible, can you give me an idea how can this be done?
    Thank you so much for taking time to read my post.
    Best regards,
    Jen
    Message was edited by:
            Jen Abap

    i will suggest you to go for classical report because it will be more easier ... but in alv list display you can achieve this kind of thing... just check this prog whether it suits you or not....
    type-pools : slis.
    tables : mara,marc,mard,makt.
    data : begin of imara occurs 0,
           matnr like mara-matnr,
           mtart like mara-mtart,
           end of imara.
    data : begin of imarc occurs 0,
           matnr like mara-matnr,
           werks like marc-werks,
           end of imarc.
    data : begin of imard occurs 0,
            matnr like mara-matnr,
            lgort like mard-lgort,
           end of imard.
    data : begin of imakt occurs 0,
           matnr like mara-matnr,
           maktx like makt-maktx,
           end of imakt.
    data : begin of itab  occurs 0,
           rowheading(16),
           matnr like mara-matnr,
           mtart like mara-mtart,
           werks like marc-werks,
           lgort like mard-lgort,
           maktx like makt-maktx,
           end of itab.
    data : ifieldcat type slis_t_fieldcat_alv,
           wfieldcat type slis_fieldcat_alv,
           ilayout type slis_layout_alv,
           IEVENT    TYPE SLIS_T_EVENT,
           WEVENT    TYPE SLIS_ALV_EVENT.
    data : tabix(3).
    select-options : s_matnr for mara-matnr obligatory.
    start-of-selection.
    perform get_data.
    perform build_finaltab.
    perform build_fieldcat.
    perform build_layout.
    perform build_eventtab.
    perform displaydata.
    *&      Form  get_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_data .
    select matnr mtart into table imara from mara where matnr in s_matnr.
    if not imara[] is initial.
    select matnr werks from marc into table imarc for all entries in imara
                                       where matnr = imara-matnr.
    select matnr lgort from mard into table imard for all entries in imara
                                       where matnr = imara-matnr.
    select matnr maktx from makt into table imakt for all entries in imara
                                       where matnr = imara-matnr.
    endif.
    ENDFORM.                    " get_data
    *&      Form  build_finaltab
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_finaltab .
    loop at imara.
    tabix = sy-tabix.
    move-corresponding imara to itab.
    read table imarc with key matnr = imara-matnr.
    itab-werks = imarc-werks.
    read table imard with key matnr = imara-matnr.
    itab-lgort = imard-lgort.
    read table imakt with key matnr = imara-matnr.
    itab-maktx = imakt-maktx.
    concatenate 'Row no' tabix into itab-rowheading separated by space.
    append itab.
    endloop.
    ENDFORM.                    " build_finaltab
    *&      Form  build_fieldcat
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcat .
    wfieldcat-fieldname = 'ROWHEADING'.
    wfieldcat-col_pos = 1.
    wfieldcat-outputlen = 15.
    wfieldcat-seltext_l = ''.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    wfieldcat-fieldname = 'MATNR'.
    wfieldcat-col_pos = 2.
    wfieldcat-outputlen = 18.
    wfieldcat-seltext_l = 'Material no'.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    wfieldcat-fieldname = 'MTART'.
    wfieldcat-col_pos = 3.
    wfieldcat-outputlen = 10.
    wfieldcat-seltext_l = 'Mat gr'.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    wfieldcat-fieldname = 'WERKS'.
    wfieldcat-col_pos = 4.
    wfieldcat-outputlen = 10.
    wfieldcat-seltext_l = 'Plant'.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    wfieldcat-fieldname = 'LGORT'.
    wfieldcat-col_pos = 5.
    wfieldcat-outputlen = 10.
    wfieldcat-seltext_l = 'Stor loc'.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    wfieldcat-fieldname = 'MAKTX'.
    wfieldcat-col_pos = 6.
    wfieldcat-outputlen = 30.
    wfieldcat-seltext_l = 'Material desc'.
    append wfieldcat to ifieldcat.
    clear wfieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_layout
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_layout .
    ilayout-no_colhead = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  build_eventtab
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_eventtab .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = IEVENT
    *   EXCEPTIONS
    *     LIST_TYPE_WRONG       = 1
    *     OTHERS                = 2
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE IEVENT INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC = 0.
        WEVENT-FORM = 'TOPOFPAGE'.
        MODIFY IEVENT FROM WEVENT INDEX SY-TABIX.
      ENDIF.
    ENDFORM.                    " build_eventtab
    *&      Form  displaydata
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM displaydata .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = sy-repid
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   I_STRUCTURE_NAME               =
       IS_LAYOUT                      = ilayout
       IT_FIELDCAT                    = ifieldcat
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *   IT_SORT                        =
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_DEFAULT                      = 'X'
    *   I_SAVE                         = ' '
    *   IS_VARIANT                     =
       IT_EVENTS                      = ievent
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = itab
    * EXCEPTIONS
    *   PROGRAM_ERROR                  = 1
    *   OTHERS                         = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " displaydata
    form topofpage.
    write : / sy-uline.
    write : /17 sy-vline,28 'Contents from MARA',47 sy-vline,
             50 'plant & strg loc',69 sy-vline, 78 'Matrl desc'.
    write : / sy-uline.
    write : /17 sy-vline,22 'Material no',36 sy-vline, 39 'Mat gr',47 sy-vline, 48 'Plant',58 sy-vline,
            60 'strg loc',69 sy-vline.
    endform.
    this is a test prog just change as per your requirement.
    regards
    shiba dutta

  • Possible for this kind of TabbedPane?

    Is it possible to implement a Miscrosoft Viso like TabbedPane, such that:
    1). Each tab is a one-row button.
    2). All tabs are listed from top to bottom, but placed at the bottom of the TabPane.
    3). When the user clicks one of the tab, the selected Tab goes to the top of the TabPane, and display the content associated with the tab in the panel.
    An example in shown here (visio):
    http://www.design-drawing.com/visio/VISCD.gif
    The left side is the TabbedPane. When user clicks the ProcessFlow tab at the bottom, it will goes to the top, and the current displaying tab (Pipes and Values...) will goes downs to the bottom. Of cource during this process, the corresponding content of the tab is displayed. [Any content is ok, no need to be a set of icons as shown in the figure].
    Thanks!

    hey RichardLee1,
    Some people have already developed java libs to do this. Just to a Google search on tabpane, cascade and java, you will find something easy enough.
    An example of one is:
    http://in.geocities.com/onlyjava2003/cascade.html
    I personly dont like the terms in the above example, a bit too restrictive. I plan to write my own and when i do, i will post it free.
    James.

  • Error: No stock posting is possible for this material..

    hello,
            I have made material with post to quality insp. indicator in MMR ...the material also need to put account assignment..i have also made PO and GR for the same..but for transfer posting ..its showing the above error...pls help....
    Also the posting is open for the current period...
    thanks
    Priyanka.P

    Hai,
    u have tick those fields for qty and value updating.
    make sure this material is inventory managed material and if it is
    then check in the material master that u have not filled anything in the plant stauts field in purchasing view
    or in th ebd1 cross plant material stsus fields
    may be u have blocked the material for the inventory activity via material master
    thanks & regards
    Swathi

Maybe you are looking for